-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
67 lines (58 loc) · 1.15 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
package main
import (
"fmt"
"os"
"github.com/schaerli/gstellar/initialize"
"github.com/schaerli/gstellar/snapshot"
"github.com/schaerli/gstellar/web"
)
func main() {
if len(os.Args) > 1 {
command := os.Args[1]
if command == "snapshot" {
if len(os.Args) > 2 {
subCommand := os.Args[2]
if subCommand == "create" {
snapshot.SnapshotCreatePrepare()
os.Exit(0)
}
if subCommand == "restore" {
snapshot.SnapshotRestorePrepare()
os.Exit(0)
}
if subCommand == "list" {
snapshot.SnapshotList()
os.Exit(0)
}
if subCommand == "drop" {
snapshot.DropSnapshotPrepare()
os.Exit(0)
}
} else {
fmt.Println("Snapshots Commands:")
fmt.Println(" create")
fmt.Println(" restore")
fmt.Println(" list")
fmt.Println(" drop")
os.Exit(0)
}
fmt.Println("snapshot arg")
os.Exit(0)
}
if command == "init" {
initialize.Init()
}
if command == "init-only-db" {
initialize.InitDb()
}
if command == "web" {
web.Start()
}
} else {
fmt.Println("Commands:")
fmt.Println(" init")
fmt.Println(" snapshot")
fmt.Println(" web")
os.Exit(0)
}
}