diff --git a/docs/docs.go b/docs/docs.go index 38c6980..6c4f41f 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -78,6 +78,7 @@ func prepareArgsWithValues(flags []cli.Flag) []*PluginArg { func parseFlags(flags []cli.Flag) []*PluginArg { args := make([]*PluginArg, 0) + namePrefix := "plugin_" for _, f := range flags { flag, ok := f.(cli.DocGenerationFlag) @@ -87,10 +88,12 @@ func parseFlags(flags []cli.Flag) []*PluginArg { modArg := &PluginArg{} - name := flag.GetEnvVars()[0] - name = strings.TrimPrefix(name, "PLUGIN_") - modArg.Name = strings.ToLower(strings.TrimSpace(name)) + name := strings.ToLower(strings.TrimSpace(flag.GetEnvVars()[0])) + if !strings.HasPrefix(name, namePrefix) { + continue + } + modArg.Name = strings.TrimPrefix(name, namePrefix) modArg.Description = flag.GetUsage() modArg.Default = flag.GetDefaultText() diff --git a/docs/docs_test.go b/docs/docs_test.go index 0133de4..0bbb505 100644 --- a/docs/docs_test.go +++ b/docs/docs_test.go @@ -42,6 +42,11 @@ func testApp() *cli.App { Usage: "slice flag", EnvVars: []string{"PLUGIN_SLICE_FLAG"}, }, + &cli.StringFlag{ + Name: "hidden.flag", + Usage: "hidden flag", + EnvVars: []string{"HIDDEN_FLAG", "PLUGIN_HIDDEN_FLAG"}, + }, }, }