MCPcopy Create free account
hub / github.com/ProfOak/flag2 / AddBool

Method AddBool

flag2.go:18–29  ·  view source on GitHub ↗
(short string, long string, desc string, val bool)

Source from the content-addressed store, hash-verified

16}
17
18func (f *FlagStruct) AddBool(short string, long string, desc string, val bool) error {
19
20 // check if it doesn't exist
21 if f.Bools[long] == (boolFlag{}) {
22 f.Bools[long] = boolFlag{short, long, desc, val}
23 } else {
24 // not empty, and already exists == no good
25 return fmt.Errorf("[FlagError] Flag already exists in list of bools %s", long)
26 }
27
28 return nil
29}
30
31func (f *FlagStruct) AddString(short string, long string, desc string, val string) error {
32

Callers 2

ParseMethod · 0.95
mainFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected