-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
46 lines (39 loc) · 851 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
package main
import (
"os"
)
var Credential *GitHubCredential
var DependencyManager = Manager{}
func main() {
if len(os.Args) < 2 {
ReportError("Expected a subcommand! Maybe start with `toybox help`?", nil, true)
}
StartupBanner()
Credential = LoadGitHubCredential()
switch os.Args[1] {
case "install":
DependencyManager.Install()
case "login":
LoginOrRenewGitHubCredential()
case "add":
bfe := BoxfileEditor{}
bfe.Add(os.Args[2])
DependencyManager.Install()
case "remove":
bfe := BoxfileEditor{}
bfe.Remove(os.Args[2])
DependencyManager.Install()
case "update":
UpdateDependency(os.Args[2])
case "generate":
GenerateProject(os.Args[2])
case "info":
DescribeBoxfile()
case "help":
ShowHelp(os.Args[len(os.Args)-1])
case "version":
PrintVersion()
default:
ShowHelp(os.Args[len(os.Args)-1])
}
}