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:
qwerty287 2022-09-25 14:36:31 +02:00 committed by GitHub
parent 1f3b6f717b
commit 896746a91a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 154 additions and 78 deletions

View file

@ -5,6 +5,11 @@ variables:
- ".woodpecker/docs.yml"
pipeline:
build-cli:
image: golang:1.18
commands:
- make docs
build:
image: *node_image
commands:

View file

@ -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)
}
}

View file

@ -252,6 +252,14 @@ execute a local build
**--backend-engine**="": backend engine to run pipelines on (default: auto-detect)
**--backend-k8s-namespace**="": backend k8s namespace (default: woodpecker)
**--backend-k8s-storage-class**="": backend k8s storage class
**--backend-k8s-storage-rwx**: backend k8s storage access mode, should ReadWriteMany (RWX) instead of ReadWriteOnce (RWO) be used? (default: true)
**--backend-k8s-volume-size**="": backend k8s volume size (default 10G) (default: 10G)
**--build-created**="": (default: 0)
**--build-event**="":
@ -344,12 +352,12 @@ execute a local build
**--server, -s**="": server address
**--system-arch**="": (default: linux/amd64)
**--system-link**="": (default: https://github.com/cncd/pipec)
**--system-name**="": (default: pipec)
**--system-platform**="":
**--timeout**="": build timeout (default: 1h0m0s)
**--token, -t**="": server auth token
@ -390,7 +398,7 @@ adds a registry
**--password**="": registry password
**--repository**="": repository name (e.g. octocat/hello-world)
**--repository, --repo**="": repository name (e.g. octocat/hello-world)
**--server, -s**="": server address
@ -406,7 +414,7 @@ remove a registry
**--log-level**="": set logging level (default: info)
**--repository**="": repository name (e.g. octocat/hello-world)
**--repository, --repo**="": repository name (e.g. octocat/hello-world)
**--server, -s**="": server address
@ -422,7 +430,7 @@ update a registry
**--password**="": registry password
**--repository**="": repository name (e.g. octocat/hello-world)
**--repository, --repo**="": repository name (e.g. octocat/hello-world)
**--server, -s**="": server address
@ -438,7 +446,7 @@ display registry info
**--log-level**="": set logging level (default: info)
**--repository**="": repository name (e.g. octocat/hello-world)
**--repository, --repo**="": repository name (e.g. octocat/hello-world)
**--server, -s**="": server address
@ -450,7 +458,7 @@ list registries
**--log-level**="": set logging level (default: info)
**--repository**="": repository name (e.g. octocat/hello-world)
**--repository, --repo**="": repository name (e.g. octocat/hello-world)
**--server, -s**="": server address
@ -472,17 +480,17 @@ adds a secret
**--event**="": secret limited to these events
**--global**: global secret
**--image**="": secret limited to these images
**--log-level**="": set logging level (default: info)
**--name**="": secret name
**--global**: global secret
**--organization**="": organization name (e.g. octocat)
**--repository**="": repository name (e.g. octocat/hello-world)
**--repository, --repo**="": repository name (e.g. octocat/hello-world)
**--server, -s**="": server address
@ -494,15 +502,15 @@ adds a secret
remove a secret
**--global**: global secret
**--log-level**="": set logging level (default: info)
**--name**="": secret name
**--global**: global secret
**--organization**="": organization name (e.g. octocat)
**--repository**="": repository name (e.g. octocat/hello-world)
**--repository, --repo**="": repository name (e.g. octocat/hello-world)
**--server, -s**="": server address
@ -514,17 +522,17 @@ update a secret
**--event**="": secret limited to these events
**--global**: global secret
**--image**="": secret limited to these images
**--log-level**="": set logging level (default: info)
**--name**="": secret name
**--global**: global secret
**--organization**="": organization name (e.g. octocat)
**--repository**="": repository name (e.g. octocat/hello-world)
**--repository, --repo**="": repository name (e.g. octocat/hello-world)
**--server, -s**="": server address
@ -536,15 +544,15 @@ update a secret
display secret info
**--global**: global secret
**--log-level**="": set logging level (default: info)
**--name**="": secret name
**--global**: global secret
**--organization**="": organization name (e.g. octocat)
**--repository**="": repository name (e.g. octocat/hello-world)
**--repository, --repo**="": repository name (e.g. octocat/hello-world)
**--server, -s**="": server address
@ -554,13 +562,13 @@ display secret info
list secrets
**--log-level**="": set logging level (default: info)
**--global**: global secret
**--log-level**="": set logging level (default: info)
**--organization**="": organization name (e.g. octocat)
**--repository**="": repository name (e.g. octocat/hello-world)
**--repository, --repo**="": repository name (e.g. octocat/hello-world)
**--server, -s**="": server address
@ -761,3 +769,91 @@ get the logging level of the server, or set it with [level]
**--server, -s**="": server address
**--token, -t**="": server auth token
## cron
manage cron jobs
**--log-level**="": set logging level (default: info)
**--server, -s**="": server address
**--token, -t**="": server auth token
### add
adds a cron
**--branch**="": cron branch
**--log-level**="": set logging level (default: info)
**--name**="": cron name
**--repository, --repo**="": repository name (e.g. octocat/hello-world)
**--schedule**="": cron schedule
**--server, -s**="": server address
**--token, -t**="": server auth token
### rm
remove a cron
**--id**="": cron id
**--log-level**="": set logging level (default: info)
**--repository, --repo**="": repository name (e.g. octocat/hello-world)
**--server, -s**="": server address
**--token, -t**="": server auth token
### update
update a cron
**--branch**="": cron branch
**--id**="": cron id
**--log-level**="": set logging level (default: info)
**--name**="": cron name
**--repository, --repo**="": repository name (e.g. octocat/hello-world)
**--schedule**="": cron schedule
**--server, -s**="": server address
**--token, -t**="": server auth token
### info
display cron info
**--id**="": cron id
**--log-level**="": set logging level (default: info)
**--repository, --repo**="": repository name (e.g. octocat/hello-world)
**--server, -s**="": server address
**--token, -t**="": server auth token
### ls
list registries
**--log-level**="": set logging level (default: info)
**--repository, --repo**="": repository name (e.g. octocat/hello-world)
**--server, -s**="": server address
**--token, -t**="": server auth token