Merge pull request #6659 from dokku/6655-cron-set
Add missing cron:set command
This commit is contained in:
@@ -4,9 +4,10 @@
|
|||||||
> New as of 0.23.0
|
> New as of 0.23.0
|
||||||
|
|
||||||
```
|
```
|
||||||
cron:list <app> [--format json|stdout] # List scheduled cron tasks for an app
|
cron:list <app> [--format json|stdout] # List scheduled cron tasks for an app
|
||||||
cron:report [<app>] [<flag>] # Display report about an app
|
cron:report [<app>] [<flag>] # Display report about an app
|
||||||
cron:run <app> <cron_id> [--detach] # Run a cron task on the fly
|
cron:run <app> <cron_id> [--detach] # Run a cron task on the fly
|
||||||
|
cron:set [--global|<app>] <key> <value> # Set or clear a cron property for an app
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
SUBCOMMANDS = subcommands/list subcommands/report subcommands/run
|
SUBCOMMANDS = subcommands/list subcommands/report subcommands/run subcommands/set
|
||||||
TRIGGERS = triggers/cron-get-property
|
TRIGGERS = triggers/cron-get-property
|
||||||
BUILD = commands subcommands triggers
|
BUILD = commands subcommands triggers
|
||||||
PLUGIN_NAME = cron
|
PLUGIN_NAME = cron
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ Additional commands:`
|
|||||||
helpContent = `
|
helpContent = `
|
||||||
cron:list <app> [--format json|stdout], List scheduled cron tasks for an app
|
cron:list <app> [--format json|stdout], List scheduled cron tasks for an app
|
||||||
cron:report [<app>] [<flag>], Display report about an app
|
cron:report [<app>] [<flag>], Display report about an app
|
||||||
cron:run <app> <cron_id> [--detach], Run a cron task on the fly`
|
cron:run <app> <cron_id> [--detach], Run a cron task on the fly
|
||||||
|
cron:set [--global|<app>] <key> <value>, Set or clear a cron property for an app`
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -40,6 +40,19 @@ func main() {
|
|||||||
appName := args.Arg(0)
|
appName := args.Arg(0)
|
||||||
cronID := args.Arg(1)
|
cronID := args.Arg(1)
|
||||||
err = cron.CommandRun(appName, cronID, *detached)
|
err = cron.CommandRun(appName, cronID, *detached)
|
||||||
|
case "set":
|
||||||
|
args := flag.NewFlagSet("cron:set", flag.ExitOnError)
|
||||||
|
global := args.Bool("global", false, "--global: set a global property")
|
||||||
|
args.Parse(os.Args[2:])
|
||||||
|
appName := args.Arg(0)
|
||||||
|
property := args.Arg(1)
|
||||||
|
value := args.Arg(2)
|
||||||
|
if *global {
|
||||||
|
appName = "--global"
|
||||||
|
property = args.Arg(0)
|
||||||
|
value = args.Arg(1)
|
||||||
|
}
|
||||||
|
err = cron.CommandSet(appName, property, value)
|
||||||
default:
|
default:
|
||||||
err = fmt.Errorf("Invalid plugin subcommand call: %s", subcommand)
|
err = fmt.Errorf("Invalid plugin subcommand call: %s", subcommand)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user