-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
89 lines (79 loc) · 2.05 KB
/
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package main
import (
"fmt"
"github.com/jpillora/opts"
)
var (
version string = "dev"
commit string
date string
)
func main() {
c := c2{}
opts.New(&c).Name("c2").Complete().Parse().Run()
}
type endpointName string
// type deployName string
// Currently suggesting the same prediction type is used for both endpoints and deploy names
// There is a bug in the opts/completion library such that only the first args complete get used.
func (endpointName) Complete(s string) []string {
// TODO get endpoints
return []string{"aaa", "abb", "c"}
}
// func (deployName) Complete(s string) []string {
// // TODO get deployNames
// return []string{"x", "y", "z"}
// }
func (*c2) Run() {
fmt.Printf("version: %s\n", version)
}
type c2 struct {
Help struct{} `opts:"mode=cmd"`
ListReleases struct{} `opts:"mode=cmd"`
ShowLog struct{} `opts:"mode=cmd"`
Version string `opts:"mode=flag"` // the default mode
Status struct {
ShowSlaves bool
} `opts:"mode=cmd"`
Start struct {
Release string `opts:"mode=arg"`
Asdeploy string `opts:"mode=arg"`
} `opts:"mode=cmd"`
Stop struct {
Deploy string `opts:"mode=arg"`
} `opts:"mode=cmd"`
RestartFrontendProxy struct {
} `opts:"mode=cmd"`
Connect struct {
Endpoint endpointName `opts:"mode=arg"`
Deploy endpointName `opts:"mode=arg"`
} `opts:"mode=cmd"`
Disconnect struct {
Endpoint endpointName `opts:"mode=arg"`
} `opts:"mode=cmd"`
Select struct {
Release string `opts:"mode=arg"`
} `opts:"mode=cmd"`
FetchContext struct {
Retry bool
} `opts:"mode=cmd"`
Unpack struct {
Release string `opts:"mode=arg"`
Todir string `opts:"mode=arg"`
} `opts:"mode=cmd"`
ExpandTemplate struct {
TemplatePath string `opts:"mode=arg,name=templatePath"`
DestPath string `opts:"mode=arg,name=destPath"`
} `opts:"mode=cmd"`
ShowDefaultNginxConfig struct {
} `opts:"mode=cmd"`
AwsDockerLoginCmd struct {
} `opts:"mode=cmd"`
GenerateSslCertificate struct {
} `opts:"mode=cmd"`
SlaveFlush struct {
} `opts:"mode=cmd"`
SlaveUpdate struct {
Repeat int
} `opts:"mode=cmd"`
}