forked from scaleway/scaleway-cli
/
cmd_wait.go
36 lines (29 loc) · 839 Bytes
/
cmd_wait.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (C) 2015 Scaleway. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE.md file.
package cli
import "github.com/scaleway/scaleway-cli/pkg/commands"
var cmdWait = &Command{
Exec: runWait,
UsageLine: "wait [OPTIONS] SERVER [SERVER...]",
Description: "Block until a server stops",
Help: "Block until a server stops.",
}
func init() {
cmdWait.Flag.BoolVar(&waitHelp, []string{"h", "-help"}, false, "Print usage")
}
// Flags
var waitHelp bool // -h, --help flag
func runWait(cmd *Command, rawArgs []string) error {
if waitHelp {
return cmd.PrintUsage()
}
if len(rawArgs) < 1 {
return cmd.PrintShortUsage()
}
args := commands.WaitArgs{
Servers: rawArgs,
}
ctx := cmd.GetContext(rawArgs)
return commands.RunWait(ctx, args)
}