-
Notifications
You must be signed in to change notification settings - Fork 1
/
node.go
63 lines (48 loc) · 968 Bytes
/
node.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
package argh
type Node interface{}
type ArgDelimiter struct{}
type Assign struct{}
type StdinFlag struct{}
type StopFlag struct{}
type Ident struct {
Literal string
}
type PassthroughArgs struct {
Nodes []Node
}
type CompoundShortFlag struct {
Nodes []Node
}
type MultiIdent struct {
Nodes []Node
}
// Command is a Node with a name, a slice of child Nodes, and
// potentially a map of named values derived from the child Nodes
type Command struct {
Name string
Values map[string]string
Nodes []Node
}
// Flag is a Node with a name, a slice of child Nodes, and
// potentially a map of named values derived from the child Nodes
type Flag struct {
Name string
Values map[string]string
Nodes []Node
}
type CommandError struct {
Pos Position
Node Node
Msg string
}
func (e CommandError) Error() string {
return e.Msg
}
type FlagError struct {
Pos Position
Node Node
Msg string
}
func (e FlagError) Error() string {
return e.Msg
}