Print help message when triggered with no flags

This commit is contained in:
Mos Roshanavand 2023-06-26 20:20:24 +02:00 committed by Bjørn Erik Pedersen
parent 79639c981c
commit 12646750aa
5 changed files with 7 additions and 0 deletions

View file

@ -110,6 +110,7 @@ See convert's subcommands toJSON, toTOML and toYAML for more information.`
cmd.PersistentFlags().StringVarP(&c.outputDir, "output", "o", "", "filesystem path to write files to") cmd.PersistentFlags().StringVarP(&c.outputDir, "output", "o", "", "filesystem path to write files to")
cmd.PersistentFlags().BoolVar(&c.unsafe, "unsafe", false, "enable less safe operations, please backup first") cmd.PersistentFlags().BoolVar(&c.unsafe, "unsafe", false, "enable less safe operations, please backup first")
cmd.RunE = nil
return nil return nil
} }

View file

@ -243,6 +243,8 @@ func (c *genCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args [
func (c *genCommand) Init(cd *simplecobra.Commandeer) error { func (c *genCommand) Init(cd *simplecobra.Commandeer) error {
cmd := cd.CobraCommand cmd := cd.CobraCommand
cmd.Short = "A collection of several useful generators." cmd.Short = "A collection of several useful generators."
cmd.RunE = nil
return nil return nil
} }

View file

@ -96,6 +96,7 @@ func (c *importCommand) Init(cd *simplecobra.Commandeer) error {
Import requires a subcommand, e.g. ` + "`hugo import jekyll jekyll_root_path target_path`." Import requires a subcommand, e.g. ` + "`hugo import jekyll jekyll_root_path target_path`."
cmd.RunE = nil
return nil return nil
} }

View file

@ -182,6 +182,7 @@ func (c *listCommand) Init(cd *simplecobra.Commandeer) error {
List requires a subcommand, e.g. hugo list drafts` List requires a subcommand, e.g. hugo list drafts`
cmd.RunE = nil
return nil return nil
} }

View file

@ -286,6 +286,8 @@ You can also specify the kind with ` + "`-k KIND`" + `.
If archetypes are provided in your theme or site, they will be used. If archetypes are provided in your theme or site, they will be used.
Ensure you run this within the root directory of your site.` Ensure you run this within the root directory of your site.`
cmd.RunE = nil
return nil return nil
} }