diff --git a/internal/generate/completions/main.go b/internal/generate/completions/main.go index f4ee70d..ef450da 100644 --- a/internal/generate/completions/main.go +++ b/internal/generate/completions/main.go @@ -8,6 +8,7 @@ import ( "time" "gabe565.com/castsponsorskip/cmd" + "gabe565.com/utils/cobrax" flag "github.com/spf13/pflag" ) @@ -39,13 +40,12 @@ func main() { var buf bytes.Buffer rootCmd.SetOut(&buf) - for _, shell := range []string{"bash", "zsh", "fish"} { - rootCmd.SetArgs([]string{"--completion=" + shell}) - if err := rootCmd.Execute(); err != nil { + for _, shell := range []cobrax.Shell{cobrax.Bash, cobrax.Zsh, cobrax.Fish} { + if err := cobrax.GenCompletion(rootCmd, shell); err != nil { panic(err) } - f, err := os.Create(filepath.Join("completions", name+"."+shell)) + f, err := os.Create(filepath.Join("completions", name+"."+string(shell))) if err != nil { panic(err) }