Modify variable names
@@ -314,16 +314,14 @@ func checkRequiredFlags(flags []Flag, context *Context) requiredFlagsErr {
for _, f := range flags {
if rf, ok := f.(RequiredFlag); ok && rf.IsRequired() {
key := strings.Split(f.GetName(), ",")
- shortName := strings.TrimSpace(key[0])
if len(key) > 1 {
// has short name
- longName := strings.TrimSpace(key[1])
- if !context.IsSet(shortName) && !context.IsSet(longName) {
+ if !context.IsSet(strings.TrimSpace(key[0])) && !context.IsSet(strings.TrimSpace(key[1])) {
missingFlags = append(missingFlags, key[0])
}
} else {
// does not have short name
- if !context.IsSet(shortName) {
+ if !context.IsSet(strings.TrimSpace(key[0])) {
missingFlags = append(missingFlags, key[0])
}
}
