New ๐ŸŒŠ wave for @helm

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 helmwave
6363 `
64+
65+ fish = `function __fish_helmwave_generate_completions
66+ 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-completion
70+ else
71+ eval $args --generate-bash-completion
72+ end
73+end
74+
75+function __fish_helmwave_complete
76+ set -l completions (__fish_helmwave_generate_completions)
77+ for opt in $completions
78+ echo "$opt"
79+ end
80+end
81+
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)" >> ~/.bashrc
81101 echo "source <(helmwave completion zsh)" >> ~/.zshrc"
102+ helmwave completion fish > ~/.config/fish/functions/helmwave.fish
82103 `,
83104 Action: func(c *cli.Context) error {
84105 if c.Args().Len() == 0 {
@@ -94,6 +115,10 @@
94115 fmt.Print(zsh) //nolint:forbidigo
95116
96117 return nil
118+ case "fish":
119+ fmt.Print(fish) //nolint:forbidigo
120+
121+ return nil
97122 default:
98123 return ErrWrongShell
99124 }