mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-03-16 17:54:07 +01: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:
@@ -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,
|
||||
|
||||
@@ -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",
|
||||
@@ -47,7 +47,7 @@ var cronCreateCmd = &cli.Command{
|
||||
Required: true,
|
||||
},
|
||||
common.FormatFlag(tmplCronList, true),
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
func cronCreate(c *cli.Context) error {
|
||||
|
||||
@@ -29,7 +29,7 @@ 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",
|
||||
@@ -37,7 +37,7 @@ var cronInfoCmd = &cli.Command{
|
||||
Required: true,
|
||||
},
|
||||
common.FormatFlag(tmplCronList, true),
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
func cronInfo(c *cli.Context) error {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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",
|
||||
@@ -50,7 +50,7 @@ var cronUpdateCmd = &cli.Command{
|
||||
Usage: "cron schedule",
|
||||
},
|
||||
common.FormatFlag(tmplCronList, true),
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
func cronUpdate(c *cli.Context) error {
|
||||
|
||||
Reference in New Issue
Block a user