/
restart.go
37 lines (33 loc) · 1 KB
/
restart.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
37
package cmd
import (
"github.com/Scalingo/cli/appdetect"
"github.com/Scalingo/cli/apps"
"github.com/Scalingo/cli/cmd/autocomplete"
"github.com/urfave/cli"
)
var (
RestartCommand = cli.Command{
Name: "restart",
Category: "App Management",
Usage: "Restart processes of your app",
Flags: []cli.Flag{appFlag, cli.BoolFlag{Name: "synchronous, s", Usage: "Do the restart synchronously", EnvVar: ""}},
Description: `Restart one or several process or your application:
Example
## Restart all the processes
scalingo --app my-app restart
## Restart all the web processes
scalingo --app my-app restart web
## Restart a specific container
scalingo --app my-app restart web-1`,
Action: func(c *cli.Context) {
currentApp := appdetect.CurrentApp(c)
if err := apps.Restart(currentApp, c.Bool("s"), c.Args()); err != nil {
errorQuit(err)
}
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "restart")
autocomplete.RestartAutoComplete(c)
},
}
)