-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmain.go
53 lines (47 loc) · 1011 Bytes
/
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
package main
import (
"fmt"
"os"
"com.lc.go.codepush/client/opt"
)
func main() {
var args []string
var notargs []string
var in_flags bool = false
for i := 0; i < len(os.Args); i++ {
if os.Args[i][0] == '-' {
in_flags = true
}
if i == 0 || in_flags {
notargs = append(notargs, os.Args[i])
} else {
args = append(args, os.Args[i])
}
}
os.Args = notargs
help := "Usage: code-push-go <command>\n" +
"Commands:\n" +
" login Authenticate in order to begin managing your apps\n" +
" logout Log out of the current session\n" +
" app View and manage your CodePush apps\n" +
" create_bundle Create react native hotfix bundle"
var command string
if len(args) <= 0 {
fmt.Println(help)
return
}
command = args[0]
switch command {
case "login":
opt.User{}.Login()
case "logout":
opt.User{}.Logout()
case "create_bundle":
opt.App{}.CreateBundle()
case "app":
opt.App{}.App(args)
default:
fmt.Println(help)
return
}
}