fix: add missing cron:set command

The code existed but somehow it wasn't exposed as a command.

Closes #6655
This commit is contained in:
Jose Diaz-Gonzalez committed 2024-03-06 01:56:25 -05:00
1 parent 66623ba2af
commit c36f23b072
4 files changed
+20 -5

No files matched your search

+4 -3
View File
@@ -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 -1
View File
@@ -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
+2 -1
View File
@@ -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)
} }