enhance sudo completions

Flag e/edit does not take an argument, so `sudo -e a` TAB would complete
subcommands.

[ci skip]
This commit is contained in:
Johannes Altmanninger 2019-12-12 09:07:58 +01:00
parent c0b3be9fb4
commit d22c7ab993

View file

@ -41,7 +41,7 @@ end
complete -c sudo -n "__fish_no_arguments" -s h -d "Display help and exit"
complete -c sudo -n "__fish_no_arguments" -s V -d "Display version information and exit"
complete -c sudo -n "__fish_sudo_no_subcommand" -s A -d "Ask for password via the askpass or \$SSH_ASKPASS program"
complete -c sudo -n "__fish_sudo_no_subcommand" -s C -d "Close all file descriptors greater or equal to the given number" -a "(seq 0 255)"
complete -c sudo -n "__fish_sudo_no_subcommand" -s C -d "Close all file descriptors greater or equal to the given number" -xa "0 1 2 255"
complete -c sudo -n "__fish_sudo_no_subcommand" -s E -d "Preserve environment"
complete -c sudo -n "__fish_sudo_no_subcommand" -s H -d "Set home"
complete -c sudo -n "__fish_sudo_no_subcommand" -s K -d "Remove the credential timestamp entirely"
@ -60,4 +60,4 @@ complete -c sudo -n "__fish_sudo_no_subcommand" -s u -a "(__fish_complete_users)
complete -c sudo -n "__fish_sudo_no_subcommand" -s v -n "__fish_no_arguments" -d "Validate the credentials, extending timeout"
# Complete the command we are executed under sudo
complete -c sudo -x -a "(__fish_complete_sudo_subcommand)"
complete -c sudo -x -n 'not __fish_seen_argument -s e' -a "(__fish_complete_sudo_subcommand)"