diff --git a/share/completions/sudo.fish b/share/completions/sudo.fish index a88f91827..b497e8bd9 100644 --- a/share/completions/sudo.fish +++ b/share/completions/sudo.fish @@ -2,7 +2,7 @@ # Completion for sudo # -complete -c sudo -d (N_ "Command to run") -x -a "(__fish_complete_subcommand)" +complete -c sudo -d (N_ "Command to run") -x -a '(__fish_complete_subcommand_root)' complete -c sudo -s h -n "__fish_no_arguments" -d (N_ "Display help and exit") complete -c sudo -s v -n "__fish_no_arguments" -d (N_ "Validate") diff --git a/share/functions/__fish_complete_subcommand_root.fish b/share/functions/__fish_complete_subcommand_root.fish new file mode 100644 index 000000000..49504ce4e --- /dev/null +++ b/share/functions/__fish_complete_subcommand_root.fish @@ -0,0 +1,8 @@ + + +function __fish_complete_subcommand_root -d "Run the __fish_complete_subcommand function using a PATH containing /sbin and /usr/sbin" + set -l PATH_OLD $PATH + set PATH /sbin /usr/sbin $PATH + __fish_complete_subcommand + set PATH $PATH_OLD +end