diff --git a/cmd/gen-docs/main.go b/cmd/gen-docs/main.go index 16b976f05..92581d07a 100644 --- a/cmd/gen-docs/main.go +++ b/cmd/gen-docs/main.go @@ -19,12 +19,6 @@ func main() { dir := docCmd.StringP("doc-path", "", "", "Path directory where you want generate doc files") help := docCmd.BoolP("help", "h", false, "Help about any command") - for _, cmd := range command.RootCmd.Commands() { - if _, hidden := cmd.Annotations["hidden"]; hidden { - command.RootCmd.RemoveCommand(cmd) - } - } - if err := docCmd.Parse(os.Args); err != nil { os.Exit(1) } diff --git a/command/credits.go b/command/credits.go index cdaeff0f3..9d5560bad 100644 --- a/command/credits.go +++ b/command/credits.go @@ -49,9 +49,9 @@ var creditsCmd = &cobra.Command{ gh credits -s # display a non-animated thank you gh credits | cat # just print the contributors, one per line `, - Args: cobra.ExactArgs(0), - RunE: ghCredits, - Annotations: map[string]string{"hidden": "true"}, + Args: cobra.ExactArgs(0), + RunE: ghCredits, + Hidden: true, } func ghCredits(cmd *cobra.Command, _ []string) error { diff --git a/command/repo.go b/command/repo.go index e98c8476b..08eb1d490 100644 --- a/command/repo.go +++ b/command/repo.go @@ -100,10 +100,9 @@ $ gh repo credits cool/repo # view credits for cool/repo $ gh repo credits -s # print a non-animated thank you $ gh repo credits | cat # pipe to just print the contributors, one per line `, - Args: cobra.MaximumNArgs(1), - RunE: repoCredits, - // NB will actually be hidden once https://github.com/cli/cli/pull/1106 is in - Annotations: map[string]string{"hidden": "true"}, + Args: cobra.MaximumNArgs(1), + RunE: repoCredits, + Hidden: true, } func parseCloneArgs(extraArgs []string) (args []string, target string) { diff --git a/command/root.go b/command/root.go index 471168014..dcabedf13 100644 --- a/command/root.go +++ b/command/root.go @@ -363,10 +363,9 @@ func rootHelpFunc(command *cobra.Command, args []string) { continue } s := " " + rpad(c.Name()+":", c.NamePadding()) + c.Short - _, hidden := c.Annotations["hidden"] if includes(coreCommandNames, c.Name()) { coreCommands = append(coreCommands, s) - } else if !hidden { + } else if !c.Hidden { additionalCommands = append(additionalCommands, s) } }