feat: shell completions

closes #533
closes #546
closes #512
This commit is contained in:
Carlos Alexandro Becker 2024-07-03 13:41:11 -03:00
parent 821d51da13
commit d7032fe57f
No known key found for this signature in database

View file

@ -46,6 +46,10 @@ var (
SilenceErrors: false,
SilenceUsage: true,
TraverseChildren: true,
Args: cobra.MaximumNArgs(1),
ValidArgsFunction: func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
return nil, cobra.ShellCompDirectiveDefault
},
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
return validateOptions(cmd)
},
@ -360,6 +364,7 @@ func init() {
Version = "unknown (built from source)"
}
rootCmd.Version = Version
rootCmd.InitDefaultCompletionCmd()
// "Glow Classic" cli arguments
rootCmd.PersistentFlags().StringVar(&configFile, "config", "", fmt.Sprintf("config file (default %s)", defaultConfigFile()))