feat: completion + README — polish and docs
This commit is contained in:
@@ -88,4 +88,24 @@ func init() {
|
||||
rootCmd.PersistentFlags().StringVarP(&flagOutput, "output", "o", "", "Output format: table, json, yaml, raw")
|
||||
rootCmd.PersistentFlags().BoolVar(&flagRaw, "raw", false, "Output raw API response")
|
||||
rootCmd.PersistentFlags().BoolVar(&flagDebug, "debug", false, "Enable debug output")
|
||||
|
||||
completionCmd := &cobra.Command{
|
||||
Use: "completion [bash|zsh|fish]",
|
||||
Short: "Generate shell completion script",
|
||||
Annotations: map[string]string{"skipProvider": "true"},
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
switch args[0] {
|
||||
case "bash":
|
||||
return rootCmd.GenBashCompletion(os.Stdout)
|
||||
case "zsh":
|
||||
return rootCmd.GenZshCompletion(os.Stdout)
|
||||
case "fish":
|
||||
return rootCmd.GenFishCompletion(os.Stdout, true)
|
||||
default:
|
||||
return fmt.Errorf("unsupported shell: %s", args[0])
|
||||
}
|
||||
},
|
||||
}
|
||||
rootCmd.AddCommand(completionCmd)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user