From 6f3711902ba5dbab6482afb253ca6d801304ad2a Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sun, 5 Feb 2023 16:15:15 -0600 Subject: [PATCH] completions/apt: Use is_first_token instead of seen_subcommand_from I think this should be preferred for all subcommand completions because it handles typos or subcommands we don't recognize better (`apt foo ` no longer suggests subcommands since the subcommand position has been taken). --- share/completions/apt.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/completions/apt.fish b/share/completions/apt.fish index 9a2d89c54..e05fc4d42 100644 --- a/share/completions/apt.fish +++ b/share/completions/apt.fish @@ -1,6 +1,6 @@ # Completions for the `apt` command -# macOS has a /usr/bin/apt that is something else entirely: +# macOS has a /usr/bin/apt that is something else entirely: # (apt - Returns the path to a Java home directory from the current user's settings) if [ "$(uname -s)" = Darwin -a "$(command -s apt)" = /usr/bin/apt ] exit 1 @@ -14,7 +14,7 @@ set -l handle_file_pkg_subcmds install function __fish_apt_subcommand -V all_subcmds set -l subcommand $argv[1] set -e argv[1] - complete -f -c apt -n "not __fish_seen_subcommand_from $all_subcmds" -a $subcommand $argv + complete -f -c apt -n "__fish_is_first_token" -a $subcommand $argv end function __fish_apt_option