From d7032fe57f7aa06e3e8f04f810db6796ed8fe42d Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Wed, 3 Jul 2024 13:41:11 -0300 Subject: [PATCH] feat: shell completions closes #533 closes #546 closes #512 --- main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.go b/main.go index 6ca2eea..3f67f9a 100644 --- a/main.go +++ b/main.go @@ -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()))