mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
complete: Obey --force-files without an option
Things like ```fish complete command -n '__fish_seen_subcommand_from subcommand' --force-files ``` would not be obeyed because we only checked force-files when there was an option. Fixes #7920.
This commit is contained in:
parent
3100cd1bb7
commit
7210261513
@ -1060,6 +1060,7 @@ bool completer_t::complete_param_for_command(const wcstring &cmd_orig, const wcs
|
|||||||
if (!this->condition_test(o.condition)) continue;
|
if (!this->condition_test(o.condition)) continue;
|
||||||
if (o.option.empty()) {
|
if (o.option.empty()) {
|
||||||
use_files = use_files && (!(o.result_mode.no_files));
|
use_files = use_files && (!(o.result_mode.no_files));
|
||||||
|
has_force = has_force || o.result_mode.force_files;
|
||||||
complete_from_args(str, o.comp, o.localized_desc(), o.flags);
|
complete_from_args(str, o.comp, o.localized_desc(), o.flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1144,7 +1145,10 @@ bool completer_t::complete_param_for_command(const wcstring &cmd_orig, const wcs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(has_force || use_files)) {
|
if (has_force) {
|
||||||
|
*out_do_file = true;
|
||||||
|
}
|
||||||
|
else if (!use_files) {
|
||||||
*out_do_file = false;
|
*out_do_file = false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -386,4 +386,13 @@ echo >$dir/target
|
|||||||
complete -C ': $dir/'
|
complete -C ': $dir/'
|
||||||
# CHECK: $dir/target
|
# CHECK: $dir/target
|
||||||
rm $dir/target
|
rm $dir/target
|
||||||
rmdir $dir
|
|
||||||
|
cd $dir
|
||||||
|
touch yummyinmytummy
|
||||||
|
complete -c fudge -f
|
||||||
|
complete -c fudge -n '__fish_seen_subcommand_from eat' -F
|
||||||
|
complete -C'fudge eat yummyin'
|
||||||
|
# CHECK: yummyinmytummy
|
||||||
|
cd -
|
||||||
|
|
||||||
|
rm -r $dir
|
||||||
|
Loading…
x
Reference in New Issue
Block a user