mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-30 03:01:15 -03:00
complete: Make -c optional
Currently, completions have to be specified like ```fish complete -c foo -l opt ``` while ```fish complete foo -l opt ``` just complains about there being too many arguments. That's kinda useless, so we just assume if there is one left-over argument that it's meant to be the command. Theoretically we could also use *all* the arguments as commands to complete, but that seems unlikely to be what the user wants. (I don't think multi-command completions really happen)
This commit is contained in:
@@ -358,3 +358,19 @@ end
|
||||
complete -c banana -a '1 2 3'
|
||||
complete -c banana
|
||||
#CHECK: complete -c banana -a '1 2 3'
|
||||
|
||||
# "-c" is optional
|
||||
complete banana -a bar
|
||||
complete banana
|
||||
#CHECK: complete -c banana -a bar
|
||||
#CHECK: complete -c banana -a '1 2 3'
|
||||
|
||||
# "-a" ain't
|
||||
complete banana bar
|
||||
#CHECKERR: complete: Too many arguments
|
||||
#CHECKERR:
|
||||
#CHECKERR: {{.*}}checks/complete.fish (line {{\d+}}):
|
||||
#CHECKERR: complete banana bar
|
||||
#CHECKERR: ^
|
||||
#CHECKERR:
|
||||
#CHECKERR: (Type 'help complete' for related documentation)
|
||||
|
||||
Reference in New Issue
Block a user