MCPcopy Index your code
hub / github.com/ProfOak/flag2 / AddString

Method AddString

flag2.go:31–42  ·  view source on GitHub ↗
(short string, long string, desc string, val string)

Source from the content-addressed store, hash-verified

29}
30
31func (f *FlagStruct) AddString(short string, long string, desc string, val string) error {
32
33 // check if it doesn't exist
34 if f.Strings[long] == (stringFlag{}) {
35 f.Strings[long] = stringFlag{short, long, desc, val}
36 } else {
37 // not empty, and already exists == no good
38 return fmt.Errorf("[FlagError] Flag already exists in list of strings: %s", long)
39 }
40
41 return nil
42}
43
44func (f FlagStruct) FlagKeys() []string {
45 // keys = list of long flag names

Callers 1

mainFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected