forked from ForceCLI/force
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
68 lines (63 loc) · 935 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package main
import (
"os"
)
var commands = []*Command{
cmdApiVersion,
cmdLogin,
cmdLogout,
cmdLogins,
cmdActive,
cmdWhoami,
cmdDescribe,
cmdCreate,
cmdSobject,
cmdBigObject,
cmdField,
cmdRecord,
cmdBulk,
cmdFetch,
cmdImport,
cmdExport,
cmdQuery,
cmdApex,
cmdTrace,
cmdLog,
cmdEventLogFile,
cmdOauth,
cmdTest,
cmdSecurity,
cmdVersion,
cmdUpdate,
cmdPush,
cmdAura,
cmdPassword,
cmdNotifySet,
cmdLimits,
cmdHelp,
cmdDataPipe,
}
func main() {
args := os.Args[1:]
if len(args) < 1 {
usage()
}
for _, cmd := range commands {
if cmd.Name() == args[0] && cmd.Run != nil {
cmd.Flag.Usage = func() {
cmd.printUsage()
}
if err := cmd.Flag.Parse(args[1:]); err != nil {
os.Exit(2)
}
creds, err := ActiveCredentials(false)
if err != nil {
ErrorAndExit(err.Error())
}
apiVersionNumber = creds.ApiVersion
cmd.Run(cmd, cmd.Flag.Args())
return
}
}
usage()
}