Commit 83676c85
83676c85cd70Merged
Dmitrii Zhiliaev <[email protected]> ยท 1 year ago ยท 1 file ยท ~1 modified
Description
feat: add fish completion
Details
- Commit
- 83676c85cd70
- Parent
- 5c584e676430
cmd/helmwave/completion.gomodifiedView file
@@ -61,6 +61,26 @@
6161
6262
compdef _helmwave helmwave6363
`64+
65+
fish = `function __fish_helmwave_generate_completions66+
set -l args (commandline -opc)67+
set -l current_token (commandline -ct)68+
if test (string match -r "^-" -- $current_token)69+
eval $args $current_token --generate-bash-completion70+
else71+
eval $args --generate-bash-completion72+
end73+
end74+
75+
function __fish_helmwave_complete76+
set -l completions (__fish_helmwave_generate_completions)77+
for opt in $completions78+
echo "$opt"79+
end80+
end81+
82+
complete -c helmwave -f -a '(__fish_helmwave_complete)'83+
`6484
)6585
6686
var (@@ -79,6 +99,7 @@
7999
Description: `80100
echo "source <(helmwave completion bash)" >> ~/.bashrc81101
echo "source <(helmwave completion zsh)" >> ~/.zshrc"102+
helmwave completion fish > ~/.config/fish/functions/helmwave.fish82103
`,83104
Action: func(c *cli.Context) error {84105
if c.Args().Len() == 0 {@@ -94,6 +115,10 @@
94115
fmt.Print(zsh) //nolint:forbidigo95116
96117
return nil118+
case "fish":119+
fmt.Print(fish) //nolint:forbidigo120+
121+
return nil97122
default:98123
return ErrWrongShell99124
}