diff options
author | Valery Piashchynski <[email protected]> | 2023-08-14 12:29:56 +0200 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2023-08-14 12:29:56 +0200 |
commit | 0a48c5557e6bfeada5fc143b138cd1b8ee6374d1 (patch) | |
tree | 7b545a58d96c1f64ad27600257f24dac0615bd5c /internal | |
parent | d5886b45fa3d8e65f6217f8f37fe848d6355c851 (diff) | |
parent | 67875c382435421951dacd17c8d7773d99257b47 (diff) |
Merge remote-tracking branch 'origin/master' into feature/sd_notify
Diffstat (limited to 'internal')
-rw-r--r-- | internal/cli/jobs/command.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/internal/cli/jobs/command.go b/internal/cli/jobs/command.go index adc930f8..b2465875 100644 --- a/internal/cli/jobs/command.go +++ b/internal/cli/jobs/command.go @@ -35,15 +35,6 @@ func NewCommand(cfgFile *string, override *[]string, silent *bool) *cobra.Comman return errors.E(op, errors.Str("no configuration file provided")) } - if len(args) == 0 { - return errors.Str("incorrect command usage, should be: rr jobs pause/resume/destroy/list") - } - - // for the commands other than list, args[1] should contain list of pipelines to pause/resume/destroy - if !listPipes && len(args[0]) == 0 { - return errors.Str("pause/resume/destroy commands should have list of the pipelines as second arg") - } - client, err := internalRpc.NewClient(*cfgFile, *override) if err != nil { return err @@ -53,21 +44,30 @@ func NewCommand(cfgFile *string, override *[]string, silent *bool) *cobra.Comman switch { case pausePipes: + if len(args) == 0 { + return errors.Str("incorrect command usage, should be: rr jobs --pause pipe1,pipe2") + } split := strings.Split(strings.Trim(args[0], " "), ",") return pause(client, split, silent) case destroyPipes: + if len(args) == 0 { + return errors.Str("incorrect command usage, should be: rr jobs --destroy pipe1,pipe2") + } split := strings.Split(strings.Trim(args[0], " "), ",") return destroy(client, split, silent) case resumePipes: + if len(args) == 0 { + return errors.Str("incorrect command usage, should be: rr jobs --resume pipe1,pipe2") + } split := strings.Split(strings.Trim(args[0], " "), ",") return resume(client, split, silent) case listPipes: return list(client) default: - return errors.Str("command should be in form of: `rr jobs pause pipe1,pipe2,etc`") + return errors.Str("command should be in form of: `rr jobs --<destroy/resume/pause> pipe1,pipe2`") } }, } |