-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtype.go
91 lines (76 loc) · 1.6 KB
/
type.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
90
91
package goNixArgParser
type Command struct {
names []string
summary string
options *OptionSet
subCommands []*Command
}
type OptionSet struct {
mergeFlagPrefix string
restsSigns []string
groupSeps []string
assignSigns []string
undefFlagPrefixes []string
options []*Option
hasCanMerge bool
hasCanConcatAssign bool
hasPrefixMatch bool
keyOptionMap map[string]*Option
flagOptionMap map[string]*Option
nameFlagMap map[string]*Flag
keyEnvMap map[string][]string
keyDefaultMap map[string][]string
}
type Option struct {
Key string
Summary string
Description string
Flags []*Flag
AcceptValue bool
MultiValues bool
OverridePrev bool
Delimiters []rune
UniqueValues bool
EnvVars []string
DefaultValues []string
Hidden bool
}
type Flag struct {
Name string
prefixMatchLen int
canMerge bool
canFollowAssign bool
canConcatAssign bool
}
type argKind int
const (
undetermArg argKind = iota
commandArg
flagArg
valueArg
undefFlagArg
undefFlagValueArg
ambiguousFlagArg
ambiguousFlagValueArg
restSignArg
restArg
groupSepArg
)
type argToken struct {
text string
kind argKind
}
type ParseResult struct {
keyOptionMap map[string]*Option
commands []string
specifiedOptions map[string][]string
envs map[string][]string
configOptions map[string][]string
defaults map[string][]string
specifiedRests []string
configRests []string
specifiedAmbigus []string
configAmbigus []string
specifiedUndefs []string
configUndefs []string
}