| 1 |
# This is a shell completion script auto-generated by https://github.com/urfave/cli for fish. |
| 2 |
|
| 3 |
function __%[1]s_perform_completion |
| 4 |
# Extract all args except the last one |
| 5 |
set -l args (commandline -opc) |
| 6 |
# Extract the last arg (partial input) |
| 7 |
set -l lastArg (commandline -ct) |
| 8 |
|
| 9 |
if string match -q -- "-*" $lastArg |
| 10 |
set results ($args[1] $args[2..-1] $lastArg --generate-shell-completion 2> /dev/null) |
| 11 |
else |
| 12 |
set results ($args[1] $args[2..-1] --generate-shell-completion 2> /dev/null) |
| 13 |
end |
| 14 |
|
| 15 |
# Remove trailing empty lines |
| 16 |
for line in $results[-1..1] |
| 17 |
if test (string trim -- $line) = "" |
| 18 |
set results $results[1..-2] |
| 19 |
else |
| 20 |
break |
| 21 |
end |
| 22 |
end |
| 23 |
|
| 24 |
for line in $results |
| 25 |
if not string match -q -- "%[1]s*" $line |
| 26 |
set -l parts (string split -m 1 ":" -- "$line") |
| 27 |
if test (count $parts) -eq 2 |
| 28 |
printf "%%s\t%%s\n" "$parts[1]" "$parts[2]" |
| 29 |
else |
| 30 |
printf "%%s\n" "$line" |
| 31 |
end |
| 32 |
end |
| 33 |
end |
| 34 |
end |
| 35 |
|
| 36 |
# Clear existing completions for %[1]s |
| 37 |
complete -c %[1]s -e |
| 38 |
# Register completion function |
| 39 |
complete -c %[1]s -f -a '(__%[1]s_perform_completion)' |