-
Notifications
You must be signed in to change notification settings - Fork 52
/
falgs.go
69 lines (63 loc) · 1.3 KB
/
falgs.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
package main
import (
"errors"
"flag"
"fmt"
"os"
)
func entry()error{
flag.Usage=func() {
FlagLsDev.Usage()
fmt.Fprintln(flag.CommandLine.Output(),"")
FlagCreate.Usage()
fmt.Fprintln(flag.CommandLine.Output(),"")
FlagRun.Usage()
fmt.Fprintln(flag.CommandLine.Output(),"")
FlagCompile.Usage()
fmt.Fprintln(flag.CommandLine.Output(),"")
FlagLsApp.Usage()
fmt.Fprintln(flag.CommandLine.Output(),"")
FlagLsPs.Usage()
fmt.Fprintln(flag.CommandLine.Output(),"")
FlagApi.Usage()
fmt.Fprintln(flag.CommandLine.Output(),"")
FlagBagBak.Usage()
fmt.Fprintln(flag.CommandLine.Output(),"")
}
if len(os.Args)<2{
flag.Usage()
return nil
}
cmd:=os.Args[1]
switch cmd{
case "lsdev":
return FlagLsDevMain(os.Args[2:])
case "lsapp":
return FlagLsAppMain(os.Args[2:])
case "lsps":
return FlagLsPsMain(os.Args[2:])
case "api":
return FlagApiMain(os.Args[2:])
case "compile":
return FlagCompileMain(os.Args[2:])
case "run":
return FlagRunMain(os.Args[2:])
case "create":
return FlagCreateMain(os.Args[2:])
case "bagbak":
return FlagBagBakMain(os.Args[2:])
case "help":
flag.Usage()
case "-h":
flag.Usage()
case "--h":
flag.Usage()
case "-help":
flag.Usage()
case "--help":
flag.Usage()
default:
return errors.New("不支持这个命令行")
}
return nil
}