1
0
mirror of https://github.com/drone/drone-cli.git synced 2024-11-26 06:07:05 +01:00

provide update and get info values for repo

This commit is contained in:
Eoin McAfee 2021-08-27 10:06:54 +01:00
parent 19b11812d3
commit 55ae12d8c4
2 changed files with 23 additions and 12 deletions

@ -56,4 +56,7 @@ Private: {{ .Private }}
Trusted: {{ .Trusted }}
Protected: {{ .Protected }}
Remote: {{ .HTTPURL }}
CancelRunning: {{ .CancelRunning }}
CancelPulls: {{ .CancelPulls }}
CancelPush: {{ .CancelPush }}
`

@ -52,6 +52,10 @@ var repoUpdateCmd = cli.Command{
Name: "auto-cancel-pushes",
Usage: "automatically cancel pending push builds",
},
cli.BoolFlag{
Name: "auto-cancel-running",
Usage: "automatically cancel running builds if newer commit pushed",
},
cli.StringFlag{
Name: "config",
Usage: "repository configuration path (e.g. .drone.yml)",
@ -80,18 +84,19 @@ func repoUpdate(c *cli.Context) error {
}
var (
visibility = c.String("visibility")
config = c.String("config")
timeout = c.Duration("timeout")
trusted = c.Bool("trusted")
throttle = c.Int64("throttle")
protected = c.Bool("protected")
ignoreForks = c.Bool("ignore-forks")
ignorePulls = c.Bool("ignore-pull-requests")
cancelPulls = c.Bool("auto-cancel-pull-requests")
cancelPush = c.Bool("auto-cancel-pushes")
buildCounter = c.Int64("build-counter")
unsafe = c.Bool("unsafe")
visibility = c.String("visibility")
config = c.String("config")
timeout = c.Duration("timeout")
trusted = c.Bool("trusted")
throttle = c.Int64("throttle")
protected = c.Bool("protected")
ignoreForks = c.Bool("ignore-forks")
ignorePulls = c.Bool("ignore-pull-requests")
cancelPulls = c.Bool("auto-cancel-pull-requests")
cancelPush = c.Bool("auto-cancel-pushes")
cancelRunning = c.Bool("auto-cancel-running")
buildCounter = c.Int64("build-counter")
unsafe = c.Bool("unsafe")
)
patch := new(drone.RepoPatch)
@ -123,6 +128,9 @@ func repoUpdate(c *cli.Context) error {
if c.IsSet("auto-cancel-pushes") {
patch.CancelPush = &cancelPush
}
if c.IsSet("auto-cancel-running") {
patch.CancelRunning = &cancelRunning
}
if c.IsSet("visibility") {
switch visibility {
case "public", "private", "internal":