-
Notifications
You must be signed in to change notification settings - Fork 2
/
flag.go
38 lines (29 loc) · 1019 Bytes
/
flag.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
package clip
// Flag is the interface for any flag.
type Flag interface {
Name() string
Short() string
Summary() string
Hidden() bool
// Define adds the flag to a given flagset.
// This method is invoked when creating a new command before the flags are
// parsed.
Define(FlagSet)
}
// FlagSet is the interface for a set of flags.
type FlagSet interface {
// Args returns the non-flag arguments passed.
Args() []string
// Changed returns whether a flag was explicitly passed to change its value.
Changed(name string) bool
// DefineBool creates a new boolean flag.
DefineBool(p *bool, name string, short string, value bool, usage string)
// DefineString creates a new string flag.
DefineString(p *string, name string, short string, value string, usage string)
// Has returns whether a flag exists by name.
Has(name string) bool
// HasShort returns whether a flag exists by short name.
HasShort(name string) bool
// Parse parses a set of command-line arguments.
Parse(args []string) error
}