mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-22 05:47:57 +00:00
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:
@@ -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"
|
||||
)
|
||||
|
||||
@@ -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) {
|
||||
|
@@ -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",
|
||||
@@ -43,7 +43,7 @@ var pipelineCreateCmd = &cli.Command{
|
||||
Name: "var",
|
||||
Usage: "key=value",
|
||||
},
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
func pipelineCreate(c *cli.Context) error {
|
||||
|
@@ -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"
|
||||
)
|
||||
|
||||
@@ -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) {
|
||||
|
@@ -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 {
|
||||
|
@@ -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"
|
||||
)
|
||||
|
||||
@@ -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) {
|
||||
|
@@ -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 {
|
||||
|
@@ -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",
|
||||
@@ -48,7 +48,7 @@ var pipelineListCmd = &cli.Command{
|
||||
Usage: "limit the list size",
|
||||
Value: 25,
|
||||
},
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
func pipelineList(c *cli.Context) error {
|
||||
|
@@ -18,10 +18,9 @@ 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{
|
||||
@@ -29,7 +28,6 @@ var pipelineLogsCmd = &cli.Command{
|
||||
Usage: "show pipeline logs",
|
||||
ArgsUsage: "<repo-id|repo-full-name> [pipeline] [stepID]",
|
||||
Action: pipelineLogs,
|
||||
Flags: common.GlobalFlags,
|
||||
}
|
||||
|
||||
func pipelineLogs(c *cli.Context) error {
|
||||
|
@@ -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,
|
||||
|
@@ -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 {
|
||||
|
@@ -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 {
|
||||
|
@@ -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"
|
||||
)
|
||||
|
||||
@@ -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) {
|
||||
|
@@ -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"
|
||||
)
|
||||
|
||||
@@ -28,7 +27,6 @@ var pipelineStopCmd = &cli.Command{
|
||||
Name: "stop",
|
||||
Usage: "stop a pipeline",
|
||||
ArgsUsage: "<repo-id|repo-full-name> [pipeline]",
|
||||
Flags: common.GlobalFlags,
|
||||
Action: pipelineStop,
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user