From 6cf30ea48100c84c2f6f269d731fcff505cf4000 Mon Sep 17 00:00:00 2001 From: Kevin Barbour Date: Tue, 12 Apr 2022 12:18:08 +0200 Subject: [PATCH] Do not generate docs for hidden flags --- doc/yaml_docs.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/yaml_docs.go b/doc/yaml_docs.go index 96e6ad7..e77b4d7 100644 --- a/doc/yaml_docs.go +++ b/doc/yaml_docs.go @@ -149,6 +149,10 @@ func genFlagResult(flags *pflag.FlagSet) []cmdOption { var result []cmdOption flags.VisitAll(func(flag *pflag.Flag) { + if flag.Hidden { + return + } + // Todo, when we mark a shorthand is deprecated, but specify an empty message. // The flag.ShorthandDeprecated is empty as the shorthand is deprecated. // Using len(flag.ShorthandDeprecated) > 0 can't handle this, others are ok.