forked from rosti-cz/rostictl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
105 lines (98 loc) · 2.38 KB
/
main.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package main
import (
"log"
"os"
"github.com/urfave/cli/v2"
)
const version = "0.1"
func handleError(err error) {
log.Fatalln(err)
}
var app = cli.NewApp()
func main() {
app := &cli.App{
Name: "Rosti.cz CLI",
Usage: "CLI application to manage projects hosted on Rosti.cz",
UsageText: "This command line tool reads Rostifile located in the current work directory and runs different commands with parameters defined in this file.\n\n rostictl [global options] command [command options] [arguments...]",
Flags: []cli.Flag{},
Commands: []*cli.Command{
{
Name: "up",
Aliases: []string{},
Usage: "Deploys new or existing application",
Flags: []cli.Flag{
&cli.IntFlag{
Name: "company",
Aliases: []string{"c"},
Value: 0,
Usage: "Company ID",
},
&cli.BoolFlag{
Name: "force-init",
Usage: "Runs initialization commands even if the application exists.",
},
},
Action: commandUp,
},
{
Name: "down",
Aliases: []string{"stop"},
Usage: "Turns the application off but doesn't remove it",
Action: commandDown,
},
{
Name: "start",
Aliases: []string{},
Usage: "Turns the application on without deploying any code",
Action: commandStart,
},
{
Name: "remove",
Aliases: []string{"rm"},
Usage: "Removes the application",
Action: commandRemove,
},
{
Name: "status",
Aliases: []string{},
Usage: "Returns status of the application",
Action: commandStatus,
},
{
Name: "plans",
Aliases: []string{},
Usage: "Prints list of available plans you can use in Rostifile",
Action: commandPlans,
},
{
Name: "companies",
Aliases: []string{},
Usage: "Prints list of companies you are member of.",
Action: commandCompanies,
},
{
Name: "runtimes",
Aliases: []string{},
Usage: "Prints list of available runtimes you can use in Rostifile",
Action: commandRuntimes,
},
{
Name: "init",
Aliases: []string{},
Usage: "Creates a new Rostifile in the current working directory",
Action: commandInit,
},
{
Name: "version",
Aliases: []string{},
Usage: "Prints version of this binary",
Action: commandVersion,
},
// backup
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}