mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-22 00:24:58 +00:00
Remove old CLI docs generation code (#1196)
Removes code that's not longer required because we use a newer version of urfave/cli. Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
@@ -19,24 +19,14 @@ package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := newApp()
|
||||
for _, cmd := range app.Commands {
|
||||
fixHiddenFlags(cmd)
|
||||
}
|
||||
md, err := app.ToMarkdown()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// Still a bug in our version of urfave/cli/v2
|
||||
// https://github.com/urfave/cli/pull/1311
|
||||
md = md[strings.Index(md, "#"):]
|
||||
|
||||
fi, err := os.Create("../../docs/docs/40-cli.md")
|
||||
if err != nil {
|
||||
@@ -47,18 +37,3 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Until https://github.com/urfave/cli/pull/1346 is merged and tagged
|
||||
func fixHiddenFlags(cmd *cli.Command) {
|
||||
var flags []cli.Flag
|
||||
for _, f := range cmd.Flags {
|
||||
val := reflect.Indirect(reflect.ValueOf(f)).FieldByName("Hidden")
|
||||
if !val.IsValid() || !val.Bool() {
|
||||
flags = append(flags, f)
|
||||
}
|
||||
}
|
||||
cmd.Flags = flags
|
||||
for _, sub := range cmd.Subcommands {
|
||||
fixHiddenFlags(sub)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user