Modify variable names
This commit is contained in:
parent
cbb9e015b8
commit
1547ac2f6a
@ -314,16 +314,14 @@ func checkRequiredFlags(flags []Flag, context *Context) requiredFlagsErr {
|
|||||||
for _, f := range flags {
|
for _, f := range flags {
|
||||||
if rf, ok := f.(RequiredFlag); ok && rf.IsRequired() {
|
if rf, ok := f.(RequiredFlag); ok && rf.IsRequired() {
|
||||||
key := strings.Split(f.GetName(), ",")
|
key := strings.Split(f.GetName(), ",")
|
||||||
shortName := strings.TrimSpace(key[0])
|
|
||||||
if len(key) > 1 {
|
if len(key) > 1 {
|
||||||
// has short name
|
// has short name
|
||||||
longName := strings.TrimSpace(key[1])
|
if !context.IsSet(strings.TrimSpace(key[0])) && !context.IsSet(strings.TrimSpace(key[1])) {
|
||||||
if !context.IsSet(shortName) && !context.IsSet(longName) {
|
|
||||||
missingFlags = append(missingFlags, key[0])
|
missingFlags = append(missingFlags, key[0])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// does not have short name
|
// does not have short name
|
||||||
if !context.IsSet(shortName) {
|
if !context.IsSet(strings.TrimSpace(key[0])) {
|
||||||
missingFlags = append(missingFlags, key[0])
|
missingFlags = append(missingFlags, key[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user