// MayString should get value from path or return val. func (am ArgMap) MayString(defaultValue string, aliases ...string) string { if len(aliases) == 0 { panic("Alias key(s) required") } for _, key := range aliases { s := to.String(am[key]) if len(s) > 0 { return s } } return defaultValue }
// AsString should get value from path or return val. func (am ArgMap) AsString(aliases ...string) string { if len(aliases) == 0 { panic("Alias key(s) required") } for _, key := range aliases { s := to.String(am[key]) if len(s) > 0 { return s } } return "" }
// MustString should get value from path or return val. func (am ArgMap) MustString(aliases ...string) string { for _, key := range aliases { if am[key] == nil { continue } s := to.String(am[key]) if s == "" { continue } return s } panic(fmt.Sprintf("None of these string flags were found: %v", aliases)) }