mirror of
https://github.com/thegeeklab/wp-plugin-go.git
synced 2024-11-25 09:30:39 +00:00
fix: dont add none-plugin flags to docs (#46)
This commit is contained in:
parent
ae9066d3cc
commit
ddde4d726e
@ -78,6 +78,7 @@ func prepareArgsWithValues(flags []cli.Flag) []*PluginArg {
|
|||||||
|
|
||||||
func parseFlags(flags []cli.Flag) []*PluginArg {
|
func parseFlags(flags []cli.Flag) []*PluginArg {
|
||||||
args := make([]*PluginArg, 0)
|
args := make([]*PluginArg, 0)
|
||||||
|
namePrefix := "plugin_"
|
||||||
|
|
||||||
for _, f := range flags {
|
for _, f := range flags {
|
||||||
flag, ok := f.(cli.DocGenerationFlag)
|
flag, ok := f.(cli.DocGenerationFlag)
|
||||||
@ -87,10 +88,12 @@ func parseFlags(flags []cli.Flag) []*PluginArg {
|
|||||||
|
|
||||||
modArg := &PluginArg{}
|
modArg := &PluginArg{}
|
||||||
|
|
||||||
name := flag.GetEnvVars()[0]
|
name := strings.ToLower(strings.TrimSpace(flag.GetEnvVars()[0]))
|
||||||
name = strings.TrimPrefix(name, "PLUGIN_")
|
if !strings.HasPrefix(name, namePrefix) {
|
||||||
modArg.Name = strings.ToLower(strings.TrimSpace(name))
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
modArg.Name = strings.TrimPrefix(name, namePrefix)
|
||||||
modArg.Description = flag.GetUsage()
|
modArg.Description = flag.GetUsage()
|
||||||
modArg.Default = flag.GetDefaultText()
|
modArg.Default = flag.GetDefaultText()
|
||||||
|
|
||||||
|
@ -42,6 +42,11 @@ func testApp() *cli.App {
|
|||||||
Usage: "slice flag",
|
Usage: "slice flag",
|
||||||
EnvVars: []string{"PLUGIN_SLICE_FLAG"},
|
EnvVars: []string{"PLUGIN_SLICE_FLAG"},
|
||||||
},
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "hidden.flag",
|
||||||
|
Usage: "hidden flag",
|
||||||
|
EnvVars: []string{"HIDDEN_FLAG", "PLUGIN_HIDDEN_FLAG"},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user