mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 13:23:09 +00:00
Cleanup __fish_complete_subcommand
The external-commands-only completion was briefly added in 3.1.0 and removed in 3.1.1 (see #6798), which means we can remove some dead code. Maybe we should just remove __fish_complete_external_command - it could break users, but then again, we don't really have a way to stop people from starting to use this deprecated function. The underscores ought to communicate that this is function is private to fish but that is not enforced.
This commit is contained in:
parent
b947e360db
commit
d7ccc475cf
8 changed files with 8 additions and 17 deletions
|
@ -1,3 +1,2 @@
|
|||
complete -c and -s h -l help -d 'Display help and exit'
|
||||
complete -c and -xa '(__fish_complete_subcommand --allow-functions-and-builtins)'
|
||||
|
||||
complete -c and -xa '(__fish_complete_subcommand)'
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
complete -c begin -s h -l help -d 'Display help and exit'
|
||||
complete -c begin -xa '(__fish_complete_subcommand --allow-functions-and-builtins)'
|
||||
complete -c begin -xa '(__fish_complete_subcommand)'
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
complete -c if -s h -l help -d 'Display help and exit'
|
||||
complete -c if -xa '(__fish_complete_subcommand --allow-functions-and-builtins)'
|
||||
complete -c if -xa '(__fish_complete_subcommand)'
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
complete -c not -s h -l help -d 'Display help and exit'
|
||||
complete -c not -xa '(__fish_complete_subcommand --allow-functions-and-builtins)'
|
||||
complete -c not -xa '(__fish_complete_subcommand)'
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
|
||||
complete -c or -s h -l help -d 'Display help and exit'
|
||||
complete -c or -xa '(__fish_complete_subcommand --allow-functions-and-builtins)'
|
||||
complete -c or -xa '(__fish_complete_subcommand)'
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
complete -c while -s h -l help -d 'Display help and exit'
|
||||
complete -c while -xa '(__fish_complete_subcommand --allow-functions-and-builtins)'
|
||||
complete -c while -xa '(__fish_complete_subcommand)'
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# TODO: This function is deprecated, figure out a way to tell users.
|
||||
function __fish_complete_external_command
|
||||
complete -C "$argv[1]"
|
||||
end
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
function __fish_complete_subcommand -d "Complete subcommand" --no-scope-shadowing
|
||||
# Pass --commandline to complete the remainder of the arguments instead of the commandline.
|
||||
# Pass --allow-functions-and-builtins to enable the completion of the first token as function or builtin.
|
||||
# Other args are considered flags to the supercommand that require an option.
|
||||
|
||||
# How many non-option tokens we skip in the input commandline before completing the subcommand
|
||||
# Usually 1; for ssh 2.
|
||||
set -l skip_next 1
|
||||
set -l allow_functions_and_builtins false
|
||||
set -l subcommand
|
||||
while string match -rq -- '^--[a-z]' $argv[1]
|
||||
set -l arg $argv[1]
|
||||
|
@ -14,8 +12,6 @@ function __fish_complete_subcommand -d "Complete subcommand" --no-scope-shadowin
|
|||
switch $arg
|
||||
case '--fcs-skip=*'
|
||||
set skip_next (string split = -- $arg)[2]
|
||||
case --allow-functions-and-builtins
|
||||
set allow_functions_and_builtins true
|
||||
case --commandline
|
||||
set subcommand $argv
|
||||
set -e argv
|
||||
|
@ -48,10 +44,5 @@ function __fish_complete_subcommand -d "Complete subcommand" --no-scope-shadowin
|
|||
end
|
||||
end
|
||||
|
||||
if test $allow_functions_and_builtins = false && test (count $subcommand) -eq 1
|
||||
__fish_complete_external_command "$subcommand"
|
||||
else
|
||||
printf "%s\n" (complete -C "$subcommand")
|
||||
end
|
||||
|
||||
printf "%s\n" (complete -C "$subcommand")
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue