Fix flags added multiple times (#2914)

Closes https://github.com/woodpecker-ci/woodpecker/issues/2912

Global flags should not be added to the commands/subscommands, only
globally.
This commit is contained in:
qwerty287 2023-12-08 09:36:53 +01:00 committed by GitHub
parent adb2c82790
commit a796885ad4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 55 additions and 120 deletions

View file

@ -16,15 +16,12 @@ package cron
import ( import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
) )
// Command exports the cron command set. // Command exports the cron command set.
var Command = &cli.Command{ var Command = &cli.Command{
Name: "cron", Name: "cron",
Usage: "manage cron jobs", Usage: "manage cron jobs",
Flags: common.GlobalFlags,
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
cronCreateCmd, cronCreateCmd,
cronDeleteCmd, cronDeleteCmd,

View file

@ -30,7 +30,7 @@ var cronCreateCmd = &cli.Command{
Usage: "add a cron job", Usage: "add a cron job",
ArgsUsage: "[repo-id|repo-full-name]", ArgsUsage: "[repo-id|repo-full-name]",
Action: cronCreate, Action: cronCreate,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
common.RepoFlag, common.RepoFlag,
&cli.StringFlag{ &cli.StringFlag{
Name: "name", Name: "name",
@ -47,7 +47,7 @@ var cronCreateCmd = &cli.Command{
Required: true, Required: true,
}, },
common.FormatFlag(tmplCronList, true), common.FormatFlag(tmplCronList, true),
), },
} }
func cronCreate(c *cli.Context) error { func cronCreate(c *cli.Context) error {

View file

@ -29,7 +29,7 @@ var cronInfoCmd = &cli.Command{
Usage: "display info about a cron job", Usage: "display info about a cron job",
ArgsUsage: "[repo-id|repo-full-name]", ArgsUsage: "[repo-id|repo-full-name]",
Action: cronInfo, Action: cronInfo,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
common.RepoFlag, common.RepoFlag,
&cli.StringFlag{ &cli.StringFlag{
Name: "id", Name: "id",
@ -37,7 +37,7 @@ var cronInfoCmd = &cli.Command{
Required: true, Required: true,
}, },
common.FormatFlag(tmplCronList, true), common.FormatFlag(tmplCronList, true),
), },
} }
func cronInfo(c *cli.Context) error { func cronInfo(c *cli.Context) error {

View file

@ -29,10 +29,10 @@ var cronListCmd = &cli.Command{
Usage: "list cron jobs", Usage: "list cron jobs",
ArgsUsage: "[repo-id|repo-full-name]", ArgsUsage: "[repo-id|repo-full-name]",
Action: cronList, Action: cronList,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
common.RepoFlag, common.RepoFlag,
common.FormatFlag(tmplCronList, true), common.FormatFlag(tmplCronList, true),
), },
} }
func cronList(c *cli.Context) error { func cronList(c *cli.Context) error {

View file

@ -28,14 +28,14 @@ var cronDeleteCmd = &cli.Command{
Usage: "remove a cron job", Usage: "remove a cron job",
ArgsUsage: "[repo-id|repo-full-name]", ArgsUsage: "[repo-id|repo-full-name]",
Action: cronDelete, Action: cronDelete,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
common.RepoFlag, common.RepoFlag,
&cli.StringFlag{ &cli.StringFlag{
Name: "id", Name: "id",
Usage: "cron id", Usage: "cron id",
Required: true, Required: true,
}, },
), },
} }
func cronDelete(c *cli.Context) error { func cronDelete(c *cli.Context) error {

View file

@ -30,7 +30,7 @@ var cronUpdateCmd = &cli.Command{
Usage: "update a cron job", Usage: "update a cron job",
ArgsUsage: "[repo-id|repo-full-name]", ArgsUsage: "[repo-id|repo-full-name]",
Action: cronUpdate, Action: cronUpdate,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
common.RepoFlag, common.RepoFlag,
&cli.StringFlag{ &cli.StringFlag{
Name: "id", Name: "id",
@ -50,7 +50,7 @@ var cronUpdateCmd = &cli.Command{
Usage: "cron schedule", Usage: "cron schedule",
}, },
common.FormatFlag(tmplCronList, true), common.FormatFlag(tmplCronList, true),
), },
} }
func cronUpdate(c *cli.Context) error { func cronUpdate(c *cli.Context) error {

View file

@ -33,7 +33,7 @@ var Command = &cli.Command{
Usage: "deploy code", Usage: "deploy code",
ArgsUsage: "<repo-id|repo-full-name> <pipeline> <environment>", ArgsUsage: "<repo-id|repo-full-name> <pipeline> <environment>",
Action: deploy, Action: deploy,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
common.FormatFlag(tmplDeployInfo), common.FormatFlag(tmplDeployInfo),
&cli.StringFlag{ &cli.StringFlag{
Name: "branch", Name: "branch",
@ -55,7 +55,7 @@ var Command = &cli.Command{
Aliases: []string{"p"}, Aliases: []string{"p"},
Usage: "custom parameters to be injected into the step environment. Format: KEY=value", Usage: "custom parameters to be injected into the step environment. Format: KEY=value",
}, },
), },
} }
func deploy(c *cli.Context) error { func deploy(c *cli.Context) error {

View file

@ -48,7 +48,7 @@ var Command = &cli.Command{
Usage: "execute a local pipeline", Usage: "execute a local pipeline",
ArgsUsage: "[path/to/.woodpecker.yaml]", ArgsUsage: "[path/to/.woodpecker.yaml]",
Action: run, Action: run,
Flags: utils.MergeSlices(common.GlobalFlags, flags, docker.Flags, kubernetes.Flags, local.Flags), Flags: utils.MergeSlices(flags, docker.Flags, kubernetes.Flags, local.Flags),
} }
func run(c *cli.Context) error { func run(c *cli.Context) error {

View file

@ -30,9 +30,7 @@ var Command = &cli.Command{
Usage: "show information about the current user", Usage: "show information about the current user",
ArgsUsage: " ", ArgsUsage: " ",
Action: info, Action: info,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{common.FormatFlag(tmplInfo, true)},
common.FormatFlag(tmplInfo, true),
),
} }
func info(c *cli.Context) error { func info(c *cli.Context) error {

View file

@ -37,7 +37,6 @@ var Command = &cli.Command{
Usage: "lint a pipeline configuration file", Usage: "lint a pipeline configuration file",
ArgsUsage: "[path/to/.woodpecker.yaml]", ArgsUsage: "[path/to/.woodpecker.yaml]",
Action: lint, Action: lint,
Flags: common.GlobalFlags,
} }
func lint(c *cli.Context) error { func lint(c *cli.Context) error {

View file

@ -16,15 +16,12 @@ package log
import ( import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
) )
// Command exports the log command set. // Command exports the log command set.
var Command = &cli.Command{ var Command = &cli.Command{
Name: "log", Name: "log",
Usage: "manage logs", Usage: "manage logs",
Flags: common.GlobalFlags,
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
logPurgeCmd, logPurgeCmd,
}, },

View file

@ -20,7 +20,6 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
) )
@ -29,7 +28,6 @@ var logPurgeCmd = &cli.Command{
Usage: "purge a log", Usage: "purge a log",
ArgsUsage: "<repo-id|repo-full-name> <pipeline>", ArgsUsage: "<repo-id|repo-full-name> <pipeline>",
Action: logPurge, Action: logPurge,
Flags: common.GlobalFlags,
} }
func logPurge(c *cli.Context) (err error) { func logPurge(c *cli.Context) (err error) {

View file

@ -19,7 +19,6 @@ import (
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
"go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker" "go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker"
) )
@ -30,7 +29,6 @@ var Command = &cli.Command{
ArgsUsage: "[level]", ArgsUsage: "[level]",
Usage: "get the logging level of the server, or set it with [level]", Usage: "get the logging level of the server, or set it with [level]",
Action: logLevel, Action: logLevel,
Flags: common.GlobalFlags,
} }
func logLevel(c *cli.Context) error { func logLevel(c *cli.Context) error {

View file

@ -20,7 +20,6 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
) )
@ -29,7 +28,6 @@ var pipelineApproveCmd = &cli.Command{
Usage: "approve a pipeline", Usage: "approve a pipeline",
ArgsUsage: "<repo-id|repo-full-name> <pipeline>", ArgsUsage: "<repo-id|repo-full-name> <pipeline>",
Action: pipelineApprove, Action: pipelineApprove,
Flags: common.GlobalFlags,
} }
func pipelineApprove(c *cli.Context) (err error) { func pipelineApprove(c *cli.Context) (err error) {

View file

@ -32,7 +32,7 @@ var pipelineCreateCmd = &cli.Command{
Usage: "create new pipeline", Usage: "create new pipeline",
ArgsUsage: "<repo-id|repo-full-name>", ArgsUsage: "<repo-id|repo-full-name>",
Action: pipelineCreate, Action: pipelineCreate,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
common.FormatFlag(tmplPipelineList), common.FormatFlag(tmplPipelineList),
&cli.StringFlag{ &cli.StringFlag{
Name: "branch", Name: "branch",
@ -43,7 +43,7 @@ var pipelineCreateCmd = &cli.Command{
Name: "var", Name: "var",
Usage: "key=value", Usage: "key=value",
}, },
), },
} }
func pipelineCreate(c *cli.Context) error { func pipelineCreate(c *cli.Context) error {

View file

@ -20,7 +20,6 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
) )
@ -29,7 +28,6 @@ var pipelineDeclineCmd = &cli.Command{
Usage: "decline a pipeline", Usage: "decline a pipeline",
ArgsUsage: "<repo-id|repo-full-name> <pipeline>", ArgsUsage: "<repo-id|repo-full-name> <pipeline>",
Action: pipelineDecline, Action: pipelineDecline,
Flags: common.GlobalFlags,
} }
func pipelineDecline(c *cli.Context) (err error) { func pipelineDecline(c *cli.Context) (err error) {

View file

@ -30,9 +30,7 @@ var pipelineInfoCmd = &cli.Command{
Usage: "show pipeline details", Usage: "show pipeline details",
ArgsUsage: "<repo-id|repo-full-name> [pipeline]", ArgsUsage: "<repo-id|repo-full-name> [pipeline]",
Action: pipelineInfo, Action: pipelineInfo,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{common.FormatFlag(tmplPipelineInfo)},
common.FormatFlag(tmplPipelineInfo),
),
} }
func pipelineInfo(c *cli.Context) error { func pipelineInfo(c *cli.Context) error {

View file

@ -20,7 +20,6 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
) )
@ -30,7 +29,6 @@ var pipelineKillCmd = &cli.Command{
ArgsUsage: "<repo-id|repo-full-name> <pipeline>", ArgsUsage: "<repo-id|repo-full-name> <pipeline>",
Action: pipelineKill, Action: pipelineKill,
Hidden: true, Hidden: true,
Flags: common.GlobalFlags,
} }
func pipelineKill(c *cli.Context) (err error) { func pipelineKill(c *cli.Context) (err error) {

View file

@ -29,14 +29,14 @@ var pipelineLastCmd = &cli.Command{
Usage: "show latest pipeline details", Usage: "show latest pipeline details",
ArgsUsage: "<repo-id|repo-full-name>", ArgsUsage: "<repo-id|repo-full-name>",
Action: pipelineLast, Action: pipelineLast,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
common.FormatFlag(tmplPipelineInfo), common.FormatFlag(tmplPipelineInfo),
&cli.StringFlag{ &cli.StringFlag{
Name: "branch", Name: "branch",
Usage: "branch name", Usage: "branch name",
Value: "main", Value: "main",
}, },
), },
} }
func pipelineLast(c *cli.Context) error { func pipelineLast(c *cli.Context) error {

View file

@ -29,7 +29,7 @@ var pipelineListCmd = &cli.Command{
Usage: "show pipeline history", Usage: "show pipeline history",
ArgsUsage: "<repo-id|repo-full-name>", ArgsUsage: "<repo-id|repo-full-name>",
Action: pipelineList, Action: pipelineList,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
common.FormatFlag(tmplPipelineList), common.FormatFlag(tmplPipelineList),
&cli.StringFlag{ &cli.StringFlag{
Name: "branch", Name: "branch",
@ -48,7 +48,7 @@ var pipelineListCmd = &cli.Command{
Usage: "limit the list size", Usage: "limit the list size",
Value: 25, Value: 25,
}, },
), },
} }
func pipelineList(c *cli.Context) error { func pipelineList(c *cli.Context) error {

View file

@ -18,10 +18,9 @@ import (
"fmt" "fmt"
"strconv" "strconv"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal"
) )
var pipelineLogsCmd = &cli.Command{ var pipelineLogsCmd = &cli.Command{
@ -29,7 +28,6 @@ var pipelineLogsCmd = &cli.Command{
Usage: "show pipeline logs", Usage: "show pipeline logs",
ArgsUsage: "<repo-id|repo-full-name> [pipeline] [stepID]", ArgsUsage: "<repo-id|repo-full-name> [pipeline] [stepID]",
Action: pipelineLogs, Action: pipelineLogs,
Flags: common.GlobalFlags,
} }
func pipelineLogs(c *cli.Context) error { func pipelineLogs(c *cli.Context) error {

View file

@ -16,15 +16,12 @@ package pipeline
import ( import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
) )
// Command exports the pipeline command set. // Command exports the pipeline command set.
var Command = &cli.Command{ var Command = &cli.Command{
Name: "pipeline", Name: "pipeline",
Usage: "manage pipelines", Usage: "manage pipelines",
Flags: common.GlobalFlags,
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
pipelineListCmd, pipelineListCmd,
pipelineLastCmd, pipelineLastCmd,

View file

@ -30,9 +30,7 @@ var pipelinePsCmd = &cli.Command{
Usage: "show pipeline steps", Usage: "show pipeline steps",
ArgsUsage: "<repo-id|repo-full-name> [pipeline]", ArgsUsage: "<repo-id|repo-full-name> [pipeline]",
Action: pipelinePs, Action: pipelinePs,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{common.FormatFlag(tmplPipelinePs)},
common.FormatFlag(tmplPipelinePs),
),
} }
func pipelinePs(c *cli.Context) error { func pipelinePs(c *cli.Context) error {

View file

@ -30,9 +30,7 @@ var pipelineQueueCmd = &cli.Command{
Usage: "show pipeline queue", Usage: "show pipeline queue",
ArgsUsage: " ", ArgsUsage: " ",
Action: pipelineQueue, Action: pipelineQueue,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{common.FormatFlag(tmplPipelineQueue)},
common.FormatFlag(tmplPipelineQueue),
),
} }
func pipelineQueue(c *cli.Context) error { func pipelineQueue(c *cli.Context) error {

View file

@ -21,7 +21,6 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
) )
@ -30,13 +29,13 @@ var pipelineStartCmd = &cli.Command{
Usage: "start a pipeline", Usage: "start a pipeline",
ArgsUsage: "<repo-id|repo-full-name> [pipeline]", ArgsUsage: "<repo-id|repo-full-name> [pipeline]",
Action: pipelineStart, Action: pipelineStart,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Name: "param", Name: "param",
Aliases: []string{"p"}, Aliases: []string{"p"},
Usage: "custom parameters to be injected into the step environment. Format: KEY=value", Usage: "custom parameters to be injected into the step environment. Format: KEY=value",
}, },
), },
} }
func pipelineStart(c *cli.Context) (err error) { func pipelineStart(c *cli.Context) (err error) {

View file

@ -20,7 +20,6 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
) )
@ -28,7 +27,6 @@ var pipelineStopCmd = &cli.Command{
Name: "stop", Name: "stop",
Usage: "stop a pipeline", Usage: "stop a pipeline",
ArgsUsage: "<repo-id|repo-full-name> [pipeline]", ArgsUsage: "<repo-id|repo-full-name> [pipeline]",
Flags: common.GlobalFlags,
Action: pipelineStop, Action: pipelineStop,
} }

View file

@ -16,15 +16,12 @@ package registry
import ( import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
) )
// Command exports the registry command set. // Command exports the registry command set.
var Command = &cli.Command{ var Command = &cli.Command{
Name: "registry", Name: "registry",
Usage: "manage registries", Usage: "manage registries",
Flags: common.GlobalFlags,
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
registryCreateCmd, registryCreateCmd,
registryDeleteCmd, registryDeleteCmd,

View file

@ -30,7 +30,7 @@ var registryCreateCmd = &cli.Command{
Usage: "adds a registry", Usage: "adds a registry",
ArgsUsage: "[repo-id|repo-full-name]", ArgsUsage: "[repo-id|repo-full-name]",
Action: registryCreate, Action: registryCreate,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
common.RepoFlag, common.RepoFlag,
&cli.StringFlag{ &cli.StringFlag{
Name: "hostname", Name: "hostname",
@ -45,7 +45,7 @@ var registryCreateCmd = &cli.Command{
Name: "password", Name: "password",
Usage: "registry password", Usage: "registry password",
}, },
), },
} }
func registryCreate(c *cli.Context) error { func registryCreate(c *cli.Context) error {

View file

@ -29,7 +29,7 @@ var registryInfoCmd = &cli.Command{
Usage: "display registry info", Usage: "display registry info",
ArgsUsage: "[repo-id|repo-full-name]", ArgsUsage: "[repo-id|repo-full-name]",
Action: registryInfo, Action: registryInfo,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
common.RepoFlag, common.RepoFlag,
&cli.StringFlag{ &cli.StringFlag{
Name: "hostname", Name: "hostname",
@ -37,7 +37,7 @@ var registryInfoCmd = &cli.Command{
Value: "docker.io", Value: "docker.io",
}, },
common.FormatFlag(tmplRegistryList, true), common.FormatFlag(tmplRegistryList, true),
), },
} }
func registryInfo(c *cli.Context) error { func registryInfo(c *cli.Context) error {

View file

@ -29,10 +29,10 @@ var registryListCmd = &cli.Command{
Usage: "list registries", Usage: "list registries",
ArgsUsage: "[repo-id|repo-full-name]", ArgsUsage: "[repo-id|repo-full-name]",
Action: registryList, Action: registryList,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
common.RepoFlag, common.RepoFlag,
common.FormatFlag(tmplRegistryList, true), common.FormatFlag(tmplRegistryList, true),
), },
} }
func registryList(c *cli.Context) error { func registryList(c *cli.Context) error {

View file

@ -26,14 +26,14 @@ var registryDeleteCmd = &cli.Command{
Usage: "remove a registry", Usage: "remove a registry",
ArgsUsage: "[repo-id|repo-full-name]", ArgsUsage: "[repo-id|repo-full-name]",
Action: registryDelete, Action: registryDelete,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
common.RepoFlag, common.RepoFlag,
&cli.StringFlag{ &cli.StringFlag{
Name: "hostname", Name: "hostname",
Usage: "registry hostname", Usage: "registry hostname",
Value: "docker.io", Value: "docker.io",
}, },
), },
} }
func registryDelete(c *cli.Context) error { func registryDelete(c *cli.Context) error {

View file

@ -30,7 +30,7 @@ var registryUpdateCmd = &cli.Command{
Usage: "update a registry", Usage: "update a registry",
ArgsUsage: "[repo-id|repo-full-name]", ArgsUsage: "[repo-id|repo-full-name]",
Action: registryUpdate, Action: registryUpdate,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
common.RepoFlag, common.RepoFlag,
&cli.StringFlag{ &cli.StringFlag{
Name: "hostname", Name: "hostname",
@ -45,7 +45,7 @@ var registryUpdateCmd = &cli.Command{
Name: "password", Name: "password",
Usage: "registry password", Usage: "registry password",
}, },
), },
} }
func registryUpdate(c *cli.Context) error { func registryUpdate(c *cli.Context) error {

View file

@ -16,15 +16,12 @@ package repo
import ( import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
) )
// Command exports the repository command. // Command exports the repository command.
var Command = &cli.Command{ var Command = &cli.Command{
Name: "repo", Name: "repo",
Usage: "manage repositories", Usage: "manage repositories",
Flags: common.GlobalFlags,
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
repoListCmd, repoListCmd,
repoInfoCmd, repoInfoCmd,

View file

@ -20,7 +20,6 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
) )
@ -29,7 +28,6 @@ var repoAddCmd = &cli.Command{
Usage: "add a repository", Usage: "add a repository",
ArgsUsage: "<forge-remote-id>", ArgsUsage: "<forge-remote-id>",
Action: repoAdd, Action: repoAdd,
Flags: common.GlobalFlags,
} }
func repoAdd(c *cli.Context) error { func repoAdd(c *cli.Context) error {

View file

@ -19,7 +19,6 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
) )
@ -28,7 +27,6 @@ var repoChownCmd = &cli.Command{
Usage: "assume ownership of a repository", Usage: "assume ownership of a repository",
ArgsUsage: "<repo-id|repo-full-name>", ArgsUsage: "<repo-id|repo-full-name>",
Action: repoChown, Action: repoChown,
Flags: common.GlobalFlags,
} }
func repoChown(c *cli.Context) error { func repoChown(c *cli.Context) error {

View file

@ -29,9 +29,7 @@ var repoInfoCmd = &cli.Command{
Usage: "show repository details", Usage: "show repository details",
ArgsUsage: "<repo-id|repo-full-name>", ArgsUsage: "<repo-id|repo-full-name>",
Action: repoInfo, Action: repoInfo,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{common.FormatFlag(tmplRepoInfo)},
common.FormatFlag(tmplRepoInfo),
),
} }
func repoInfo(c *cli.Context) error { func repoInfo(c *cli.Context) error {

View file

@ -29,13 +29,13 @@ var repoListCmd = &cli.Command{
Usage: "list all repos", Usage: "list all repos",
ArgsUsage: " ", ArgsUsage: " ",
Action: repoList, Action: repoList,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
common.FormatFlag(tmplRepoList), common.FormatFlag(tmplRepoList),
&cli.StringFlag{ &cli.StringFlag{
Name: "org", Name: "org",
Usage: "filter by organization", Usage: "filter by organization",
}, },
), },
} }
func repoList(c *cli.Context) error { func repoList(c *cli.Context) error {

View file

@ -19,7 +19,6 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
) )
@ -28,7 +27,6 @@ var repoRepairCmd = &cli.Command{
Usage: "repair repository webhooks", Usage: "repair repository webhooks",
ArgsUsage: "<repo-id|repo-full-name>", ArgsUsage: "<repo-id|repo-full-name>",
Action: repoRepair, Action: repoRepair,
Flags: common.GlobalFlags,
} }
func repoRepair(c *cli.Context) error { func repoRepair(c *cli.Context) error {

View file

@ -19,7 +19,6 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
) )
@ -28,7 +27,6 @@ var repoRemoveCmd = &cli.Command{
Usage: "remove a repository", Usage: "remove a repository",
ArgsUsage: "<repo-id|repo-full-name>", ArgsUsage: "<repo-id|repo-full-name>",
Action: repoRemove, Action: repoRemove,
Flags: common.GlobalFlags,
} }
func repoRemove(c *cli.Context) error { func repoRemove(c *cli.Context) error {

View file

@ -29,9 +29,7 @@ var repoSyncCmd = &cli.Command{
Usage: "synchronize the repository list", Usage: "synchronize the repository list",
ArgsUsage: " ", ArgsUsage: " ",
Action: repoSync, Action: repoSync,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{common.FormatFlag(tmplRepoList)},
common.FormatFlag(tmplRepoList),
),
} }
// TODO: remove this and add an option to the list cmd as we do not store the remote repo list anymore // TODO: remove this and add an option to the list cmd as we do not store the remote repo list anymore

View file

@ -20,7 +20,6 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
"go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker" "go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker"
) )
@ -30,7 +29,7 @@ var repoUpdateCmd = &cli.Command{
Usage: "update a repository", Usage: "update a repository",
ArgsUsage: "<repo-id|repo-full-name>", ArgsUsage: "<repo-id|repo-full-name>",
Action: repoUpdate, Action: repoUpdate,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
&cli.BoolFlag{ &cli.BoolFlag{
Name: "trusted", Name: "trusted",
Usage: "repository is trusted", Usage: "repository is trusted",
@ -59,7 +58,7 @@ var repoUpdateCmd = &cli.Command{
Name: "unsafe", Name: "unsafe",
Usage: "validate updating the pipeline-counter is unsafe", Usage: "validate updating the pipeline-counter is unsafe",
}, },
), },
} }
func repoUpdate(c *cli.Context) error { func repoUpdate(c *cli.Context) error {

View file

@ -21,7 +21,6 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
"go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker" "go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker"
) )
@ -30,7 +29,6 @@ import (
var Command = &cli.Command{ var Command = &cli.Command{
Name: "secret", Name: "secret",
Usage: "manage secrets", Usage: "manage secrets",
Flags: common.GlobalFlags,
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
secretCreateCmd, secretCreateCmd,
secretDeleteCmd, secretDeleteCmd,

View file

@ -30,7 +30,7 @@ var secretCreateCmd = &cli.Command{
Usage: "adds a secret", Usage: "adds a secret",
ArgsUsage: "[repo-id|repo-full-name]", ArgsUsage: "[repo-id|repo-full-name]",
Action: secretCreate, Action: secretCreate,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
&cli.BoolFlag{ &cli.BoolFlag{
Name: "global", Name: "global",
Usage: "global secret", Usage: "global secret",
@ -53,7 +53,7 @@ var secretCreateCmd = &cli.Command{
Name: "image", Name: "image",
Usage: "secret limited to these images", Usage: "secret limited to these images",
}, },
), },
} }
func secretCreate(c *cli.Context) error { func secretCreate(c *cli.Context) error {

View file

@ -30,7 +30,7 @@ var secretInfoCmd = &cli.Command{
Usage: "display secret info", Usage: "display secret info",
ArgsUsage: "[repo-id|repo-full-name]", ArgsUsage: "[repo-id|repo-full-name]",
Action: secretInfo, Action: secretInfo,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
&cli.BoolFlag{ &cli.BoolFlag{
Name: "global", Name: "global",
Usage: "global secret", Usage: "global secret",
@ -42,7 +42,7 @@ var secretInfoCmd = &cli.Command{
Usage: "secret name", Usage: "secret name",
}, },
common.FormatFlag(tmplSecretList, true), common.FormatFlag(tmplSecretList, true),
), },
} }
func secretInfo(c *cli.Context) error { func secretInfo(c *cli.Context) error {

View file

@ -31,7 +31,7 @@ var secretListCmd = &cli.Command{
Usage: "list secrets", Usage: "list secrets",
ArgsUsage: "[repo-id|repo-full-name]", ArgsUsage: "[repo-id|repo-full-name]",
Action: secretList, Action: secretList,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
&cli.BoolFlag{ &cli.BoolFlag{
Name: "global", Name: "global",
Usage: "global secret", Usage: "global secret",
@ -39,7 +39,7 @@ var secretListCmd = &cli.Command{
common.OrgFlag, common.OrgFlag,
common.RepoFlag, common.RepoFlag,
common.FormatFlag(tmplSecretList, true), common.FormatFlag(tmplSecretList, true),
), },
} }
func secretList(c *cli.Context) error { func secretList(c *cli.Context) error {

View file

@ -26,7 +26,7 @@ var secretDeleteCmd = &cli.Command{
Usage: "remove a secret", Usage: "remove a secret",
ArgsUsage: "[repo-id|repo-full-name]", ArgsUsage: "[repo-id|repo-full-name]",
Action: secretDelete, Action: secretDelete,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
&cli.BoolFlag{ &cli.BoolFlag{
Name: "global", Name: "global",
Usage: "global secret", Usage: "global secret",
@ -37,7 +37,7 @@ var secretDeleteCmd = &cli.Command{
Name: "name", Name: "name",
Usage: "secret name", Usage: "secret name",
}, },
), },
} }
func secretDelete(c *cli.Context) error { func secretDelete(c *cli.Context) error {

View file

@ -30,7 +30,7 @@ var secretUpdateCmd = &cli.Command{
Usage: "update a secret", Usage: "update a secret",
ArgsUsage: "[repo-id|repo-full-name]", ArgsUsage: "[repo-id|repo-full-name]",
Action: secretUpdate, Action: secretUpdate,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{
&cli.BoolFlag{ &cli.BoolFlag{
Name: "global", Name: "global",
Usage: "global secret", Usage: "global secret",
@ -53,7 +53,7 @@ var secretUpdateCmd = &cli.Command{
Name: "image", Name: "image",
Usage: "secret limited to these images", Usage: "secret limited to these images",
}, },
), },
} }
func secretUpdate(c *cli.Context) error { func secretUpdate(c *cli.Context) error {

View file

@ -16,15 +16,12 @@ package user
import ( import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
) )
// Command exports the user command set. // Command exports the user command set.
var Command = &cli.Command{ var Command = &cli.Command{
Name: "user", Name: "user",
Usage: "manage users", Usage: "manage users",
Flags: common.GlobalFlags,
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
userListCmd, userListCmd,
userInfoCmd, userInfoCmd,

View file

@ -19,7 +19,6 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
"go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker" "go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker"
) )
@ -29,7 +28,6 @@ var userAddCmd = &cli.Command{
Usage: "adds a user", Usage: "adds a user",
ArgsUsage: "<username>", ArgsUsage: "<username>",
Action: userAdd, Action: userAdd,
Flags: common.GlobalFlags,
} }
func userAdd(c *cli.Context) error { func userAdd(c *cli.Context) error {

View file

@ -30,9 +30,7 @@ var userInfoCmd = &cli.Command{
Usage: "show user details", Usage: "show user details",
ArgsUsage: "<username>", ArgsUsage: "<username>",
Action: userInfo, Action: userInfo,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{common.FormatFlag(tmplUserInfo)},
common.FormatFlag(tmplUserInfo),
),
} }
func userInfo(c *cli.Context) error { func userInfo(c *cli.Context) error {

View file

@ -29,9 +29,7 @@ var userListCmd = &cli.Command{
Usage: "list all users", Usage: "list all users",
ArgsUsage: " ", ArgsUsage: " ",
Action: userList, Action: userList,
Flags: append(common.GlobalFlags, Flags: []cli.Flag{common.FormatFlag(tmplUserList)},
common.FormatFlag(tmplUserList),
),
} }
func userList(c *cli.Context) error { func userList(c *cli.Context) error {

View file

@ -19,7 +19,6 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
) )
@ -28,7 +27,6 @@ var userRemoveCmd = &cli.Command{
Usage: "remove a user", Usage: "remove a user",
ArgsUsage: "<username>", ArgsUsage: "<username>",
Action: userRemove, Action: userRemove,
Flags: common.GlobalFlags,
} }
func userRemove(c *cli.Context) error { func userRemove(c *cli.Context) error {