Skip to content

Commit

Permalink
Print help message when triggered with no flags
Browse files Browse the repository at this point in the history
  • Loading branch information
roshanavand authored and bep committed Jun 28, 2023
1 parent 79639c9 commit 1264675
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions commands/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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().BoolVar(&c.unsafe, "unsafe", false, "enable less safe operations, please backup first")

cmd.RunE = nil
return nil
}

Expand Down
2 changes: 2 additions & 0 deletions commands/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ func (c *genCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args [
func (c *genCommand) Init(cd *simplecobra.Commandeer) error {
cmd := cd.CobraCommand
cmd.Short = "A collection of several useful generators."

cmd.RunE = nil
return nil
}

Expand Down
1 change: 1 addition & 0 deletions commands/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`."

cmd.RunE = nil
return nil
}

Expand Down
1 change: 1 addition & 0 deletions commands/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ func (c *listCommand) Init(cd *simplecobra.Commandeer) error {
List requires a subcommand, e.g. hugo list drafts`

cmd.RunE = nil
return nil
}

Expand Down
2 changes: 2 additions & 0 deletions commands/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Ensure you run this within the root directory of your site.`

cmd.RunE = nil
return nil
}

Expand Down

0 comments on commit 1264675

Please sign in to comment.