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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
// Use of this source code is governed by the GPL 3.0
package main
import (
"go.wit.com/lib/protobuf/argvpb"
"go.wit.com/lib/protobuf/filepb"
"go.wit.com/log"
)
func subCommand() (string, error) {
// Standard subcommand handling starts here
var s string
var err error
if argv.Upgrade != nil {
doUpgrade()
argvpb.GoodExit("")
}
if argv.Linux != nil {
if argv.Linux.Rdate != nil {
s, err = doRdate()
} else {
setTerminalTitle("pinging google", "ping", []string{"google.com"})
}
}
if argv.Build != nil {
s, err = doBuild()
}
if argv.Test != nil {
s, err = doTest()
}
if argv.Git != nil {
initMachine()
s, err = doGit()
}
if argv.PB != nil {
pbuuid, pbver, pberr := filepb.IdentifyPB(argv.PB.Identify)
if pberr == nil {
log.Info("pb version is:", pbver)
log.Info("pb uuid is:", pbuuid)
s = "pb identify worked"
} else {
s = "identify failed"
err = pberr
}
}
if argv.Clone != nil {
doClone()
argvpb.GoodExit("")
}
if argv.WITCOM {
doWITCOM()
argvpb.GoodExit("")
}
if argv.Clone != nil {
doClone()
argvpb.GoodExit("")
}
if argv.WITCOM {
doWITCOM()
argvpb.GoodExit("")
}
if argv.Upgrade != nil {
doUpgrade()
}
if argv.Droplet != nil {
s, err = doDroplet()
}
if argv.Publish != nil {
if err := doPublish(); err != nil {
argvpb.BadExit("doPublish failed", err)
}
argvpb.GoodExit("")
}
if argv.Zoo != nil {
if areSuperuser() {
exitOnErrorRealtime([]string{"journalctl", "-n", "100", "-f", "_SYSTEMD_UNIT=zood.service"})
}
argvpb.GoodExit("do something here")
}
return s, err
}
|