mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00: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
2 changed files with 15 additions and 2 deletions
|
@ -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 (o.option.empty()) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -386,4 +386,13 @@ echo >$dir/target
|
|||
complete -C ': $dir/'
|
||||
# CHECK: $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…
Reference in a new issue