File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -13,5 +13,6 @@ var Command = cli.Command{
13
13
cronDeleteCmd ,
14
14
cronDisableCmd ,
15
15
cronEnableCmd ,
16
+ cronExecCmd ,
16
17
},
17
18
}
Original file line number Diff line number Diff line change
1
+ package cron
2
+
3
+ import (
4
+ "errors"
5
+
6
+ "github.com/drone/drone-cli/drone/internal"
7
+ "github.com/urfave/cli"
8
+ )
9
+
10
+ var cronExecCmd = cli.Command {
11
+ Name : "exec" ,
12
+ Usage : "trigger cron job" ,
13
+ ArgsUsage : "[repo/name] [cronjob]" ,
14
+ Action : cronExec ,
15
+ }
16
+
17
+ func cronExec (c * cli.Context ) error {
18
+ slug := c .Args ().First ()
19
+ owner , name , err := internal .ParseRepo (slug )
20
+ if err != nil {
21
+ return err
22
+ }
23
+
24
+ client , err := internal .NewClient (c )
25
+ if err != nil {
26
+ return err
27
+ }
28
+
29
+ cron := c .Args ().Get (1 )
30
+ if cron == "" {
31
+ return errors .New ("missing cronjob name" )
32
+ }
33
+
34
+ return client .CronExec (owner , name , cron )
35
+ }
You can’t perform that action at this time.
0 commit comments