30 lines
390 B
Go
30 lines
390 B
Go
|
package flags
|
||
|
|
||
|
type Set []Flag
|
||
|
|
||
|
func NewSet() Set {
|
||
|
return Set{}
|
||
|
}
|
||
|
|
||
|
func (s Set) Add(f Flag) Set {
|
||
|
return append(s, f)
|
||
|
}
|
||
|
|
||
|
func (s Set) Get(name string) (Flag, bool) {
|
||
|
for _, f := range s {
|
||
|
if f.Name() == name {
|
||
|
return f, true
|
||
|
}
|
||
|
|
||
|
if f.ShortName() == name {
|
||
|
return f, true
|
||
|
}
|
||
|
}
|
||
|
return nil, false
|
||
|
}
|
||
|
|
||
|
// TODO: Implement
|
||
|
func (s Set) Parse(args []string) error {
|
||
|
return nil
|
||
|
}
|