Skip to content

Commit

Permalink
Modify variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
asahasrabuddhe committed Sep 11, 2019
1 parent cbb9e01 commit 1547ac2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}
}
Expand Down

0 comments on commit 1547ac2

Please sign in to comment.