Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flags added multiple times #2914

Merged
merged 3 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions cli/cron/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@ package cron

import (
"github.com/urfave/cli/v2"

"go.woodpecker-ci.org/woodpecker/v2/cli/common"
)

// Command exports the cron command set.
var Command = &cli.Command{
Name: "cron",
Usage: "manage cron jobs",
Flags: common.GlobalFlags,
Subcommands: []*cli.Command{
cronCreateCmd,
cronDeleteCmd,
Expand Down
4 changes: 2 additions & 2 deletions cli/cron/cron_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var cronCreateCmd = &cli.Command{
Usage: "add a cron job",
ArgsUsage: "[repo-id|repo-full-name]",
Action: cronCreate,
Flags: append(common.GlobalFlags,
Flags: []cli.Flag{
common.RepoFlag,
&cli.StringFlag{
Name: "name",
Expand All @@ -47,7 +47,7 @@ var cronCreateCmd = &cli.Command{
Required: true,
},
common.FormatFlag(tmplCronList, true),
),
},
}

func cronCreate(c *cli.Context) error {
Expand Down
4 changes: 2 additions & 2 deletions cli/cron/cron_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ var cronInfoCmd = &cli.Command{
Usage: "display info about a cron job",
ArgsUsage: "[repo-id|repo-full-name]",
Action: cronInfo,
Flags: append(common.GlobalFlags,
Flags: []cli.Flag{
common.RepoFlag,
&cli.StringFlag{
Name: "id",
Usage: "cron id",
Required: true,
},
common.FormatFlag(tmplCronList, true),
),
},
}

func cronInfo(c *cli.Context) error {
Expand Down
4 changes: 2 additions & 2 deletions cli/cron/cron_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ var cronListCmd = &cli.Command{
Usage: "list cron jobs",
ArgsUsage: "[repo-id|repo-full-name]",
Action: cronList,
Flags: append(common.GlobalFlags,
Flags: []cli.Flag{
common.RepoFlag,
common.FormatFlag(tmplCronList, true),
),
},
}

func cronList(c *cli.Context) error {
Expand Down
4 changes: 2 additions & 2 deletions cli/cron/cron_rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ var cronDeleteCmd = &cli.Command{
Usage: "remove a cron job",
ArgsUsage: "[repo-id|repo-full-name]",
Action: cronDelete,
Flags: append(common.GlobalFlags,
Flags: []cli.Flag{
common.RepoFlag,
&cli.StringFlag{
Name: "id",
Usage: "cron id",
Required: true,
},
),
},
}

func cronDelete(c *cli.Context) error {
Expand Down
4 changes: 2 additions & 2 deletions cli/cron/cron_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var cronUpdateCmd = &cli.Command{
Usage: "update a cron job",
ArgsUsage: "[repo-id|repo-full-name]",
Action: cronUpdate,
Flags: append(common.GlobalFlags,
Flags: []cli.Flag{
common.RepoFlag,
&cli.StringFlag{
Name: "id",
Expand All @@ -50,7 +50,7 @@ var cronUpdateCmd = &cli.Command{
Usage: "cron schedule",
},
common.FormatFlag(tmplCronList, true),
),
},
}

func cronUpdate(c *cli.Context) error {
Expand Down
4 changes: 2 additions & 2 deletions cli/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var Command = &cli.Command{
Usage: "deploy code",
ArgsUsage: "<repo-id|repo-full-name> <pipeline> <environment>",
Action: deploy,
Flags: append(common.GlobalFlags,
Flags: []cli.Flag{
common.FormatFlag(tmplDeployInfo),
&cli.StringFlag{
Name: "branch",
Expand All @@ -55,7 +55,7 @@ var Command = &cli.Command{
Aliases: []string{"p"},
Usage: "custom parameters to be injected into the step environment. Format: KEY=value",
},
),
},
}

func deploy(c *cli.Context) error {
Expand Down
2 changes: 1 addition & 1 deletion cli/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var Command = &cli.Command{
Usage: "execute a local pipeline",
ArgsUsage: "[path/to/.woodpecker.yaml]",
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 {
Expand Down
4 changes: 1 addition & 3 deletions cli/info/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ var Command = &cli.Command{
Usage: "show information about the current user",
ArgsUsage: " ",
Action: info,
Flags: append(common.GlobalFlags,
common.FormatFlag(tmplInfo, true),
),
Flags: []cli.Flag{common.FormatFlag(tmplInfo, true)},
}

func info(c *cli.Context) error {
Expand Down
1 change: 0 additions & 1 deletion cli/lint/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ var Command = &cli.Command{
Usage: "lint a pipeline configuration file",
ArgsUsage: "[path/to/.woodpecker.yaml]",
Action: lint,
Flags: common.GlobalFlags,
}

func lint(c *cli.Context) error {
Expand Down
3 changes: 0 additions & 3 deletions cli/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@ package log

import (
"github.com/urfave/cli/v2"

"go.woodpecker-ci.org/woodpecker/v2/cli/common"
)

// Command exports the log command set.
var Command = &cli.Command{
Name: "log",
Usage: "manage logs",
Flags: common.GlobalFlags,
Subcommands: []*cli.Command{
logPurgeCmd,
},
Expand Down
2 changes: 0 additions & 2 deletions cli/log/log_purge.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (

"github.com/urfave/cli/v2"

"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal"
)

Expand All @@ -29,7 +28,6 @@ var logPurgeCmd = &cli.Command{
Usage: "purge a log",
ArgsUsage: "<repo-id|repo-full-name> <pipeline>",
Action: logPurge,
Flags: common.GlobalFlags,
}

func logPurge(c *cli.Context) (err error) {
Expand Down
2 changes: 0 additions & 2 deletions cli/loglevel/loglevel.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"github.com/rs/zerolog/log"
"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/woodpecker-go/woodpecker"
)
Expand All @@ -30,7 +29,6 @@ var Command = &cli.Command{
ArgsUsage: "[level]",
Usage: "get the logging level of the server, or set it with [level]",
Action: logLevel,
Flags: common.GlobalFlags,
}

func logLevel(c *cli.Context) error {
Expand Down
2 changes: 0 additions & 2 deletions cli/pipeline/approve.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (

"github.com/urfave/cli/v2"

"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal"
)

Expand All @@ -29,7 +28,6 @@ var pipelineApproveCmd = &cli.Command{
Usage: "approve a pipeline",
ArgsUsage: "<repo-id|repo-full-name> <pipeline>",
Action: pipelineApprove,
Flags: common.GlobalFlags,
}

func pipelineApprove(c *cli.Context) (err error) {
Expand Down
4 changes: 2 additions & 2 deletions cli/pipeline/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var pipelineCreateCmd = &cli.Command{
Usage: "create new pipeline",
ArgsUsage: "<repo-id|repo-full-name>",
Action: pipelineCreate,
Flags: append(common.GlobalFlags,
Flags: []cli.Flag{
common.FormatFlag(tmplPipelineList),
&cli.StringFlag{
Name: "branch",
Expand All @@ -43,7 +43,7 @@ var pipelineCreateCmd = &cli.Command{
Name: "var",
Usage: "key=value",
},
),
},
}

func pipelineCreate(c *cli.Context) error {
Expand Down
2 changes: 0 additions & 2 deletions cli/pipeline/decline.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (

"github.com/urfave/cli/v2"

"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal"
)

Expand All @@ -29,7 +28,6 @@ var pipelineDeclineCmd = &cli.Command{
Usage: "decline a pipeline",
ArgsUsage: "<repo-id|repo-full-name> <pipeline>",
Action: pipelineDecline,
Flags: common.GlobalFlags,
}

func pipelineDecline(c *cli.Context) (err error) {
Expand Down
4 changes: 1 addition & 3 deletions cli/pipeline/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ var pipelineInfoCmd = &cli.Command{
Usage: "show pipeline details",
ArgsUsage: "<repo-id|repo-full-name> [pipeline]",
Action: pipelineInfo,
Flags: append(common.GlobalFlags,
common.FormatFlag(tmplPipelineInfo),
),
Flags: []cli.Flag{common.FormatFlag(tmplPipelineInfo)},
}

func pipelineInfo(c *cli.Context) error {
Expand Down
2 changes: 0 additions & 2 deletions cli/pipeline/kill.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (

"github.com/urfave/cli/v2"

"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal"
)

Expand All @@ -30,7 +29,6 @@ var pipelineKillCmd = &cli.Command{
ArgsUsage: "<repo-id|repo-full-name> <pipeline>",
Action: pipelineKill,
Hidden: true,
Flags: common.GlobalFlags,
}

func pipelineKill(c *cli.Context) (err error) {
Expand Down
4 changes: 2 additions & 2 deletions cli/pipeline/last.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ var pipelineLastCmd = &cli.Command{
Usage: "show latest pipeline details",
ArgsUsage: "<repo-id|repo-full-name>",
Action: pipelineLast,
Flags: append(common.GlobalFlags,
Flags: []cli.Flag{
common.FormatFlag(tmplPipelineInfo),
&cli.StringFlag{
Name: "branch",
Usage: "branch name",
Value: "main",
},
),
},
}

func pipelineLast(c *cli.Context) error {
Expand Down
4 changes: 2 additions & 2 deletions cli/pipeline/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var pipelineListCmd = &cli.Command{
Usage: "show pipeline history",
ArgsUsage: "<repo-id|repo-full-name>",
Action: pipelineList,
Flags: append(common.GlobalFlags,
Flags: []cli.Flag{
common.FormatFlag(tmplPipelineList),
&cli.StringFlag{
Name: "branch",
Expand All @@ -48,7 +48,7 @@ var pipelineListCmd = &cli.Command{
Usage: "limit the list size",
Value: 25,
},
),
},
}

func pipelineList(c *cli.Context) error {
Expand Down
6 changes: 2 additions & 4 deletions cli/pipeline/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@ import (
"fmt"
"strconv"

"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal"

"github.com/urfave/cli/v2"

"go.woodpecker-ci.org/woodpecker/v2/cli/internal"
)

var pipelineLogsCmd = &cli.Command{
Name: "logs",
Usage: "show pipeline logs",
ArgsUsage: "<repo-id|repo-full-name> [pipeline] [stepID]",
Action: pipelineLogs,
Flags: common.GlobalFlags,
}

func pipelineLogs(c *cli.Context) error {
Expand Down
3 changes: 0 additions & 3 deletions cli/pipeline/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@ package pipeline

import (
"github.com/urfave/cli/v2"

"go.woodpecker-ci.org/woodpecker/v2/cli/common"
)

// Command exports the pipeline command set.
var Command = &cli.Command{
Name: "pipeline",
Usage: "manage pipelines",
Flags: common.GlobalFlags,
Subcommands: []*cli.Command{
pipelineListCmd,
pipelineLastCmd,
Expand Down
4 changes: 1 addition & 3 deletions cli/pipeline/ps.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ var pipelinePsCmd = &cli.Command{
Usage: "show pipeline steps",
ArgsUsage: "<repo-id|repo-full-name> [pipeline]",
Action: pipelinePs,
Flags: append(common.GlobalFlags,
common.FormatFlag(tmplPipelinePs),
),
Flags: []cli.Flag{common.FormatFlag(tmplPipelinePs)},
}

func pipelinePs(c *cli.Context) error {
Expand Down
4 changes: 1 addition & 3 deletions cli/pipeline/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ var pipelineQueueCmd = &cli.Command{
Usage: "show pipeline queue",
ArgsUsage: " ",
Action: pipelineQueue,
Flags: append(common.GlobalFlags,
common.FormatFlag(tmplPipelineQueue),
),
Flags: []cli.Flag{common.FormatFlag(tmplPipelineQueue)},
}

func pipelineQueue(c *cli.Context) error {
Expand Down
5 changes: 2 additions & 3 deletions cli/pipeline/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

"github.com/urfave/cli/v2"

"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal"
)

Expand All @@ -30,13 +29,13 @@ var pipelineStartCmd = &cli.Command{
Usage: "start a pipeline",
ArgsUsage: "<repo-id|repo-full-name> [pipeline]",
Action: pipelineStart,
Flags: append(common.GlobalFlags,
Flags: []cli.Flag{
&cli.StringSliceFlag{
Name: "param",
Aliases: []string{"p"},
Usage: "custom parameters to be injected into the step environment. Format: KEY=value",
},
),
},
}

func pipelineStart(c *cli.Context) (err error) {
Expand Down
Loading