Only prepend EnvPrefix if .Env is not empty.
Before this change the EnvPrefix was applied to fields without env specified, which resulted in strange and confusing help output.
This commit is contained in:
committed by
Alec Thomas
parent
2770a34ce6
commit
ea18c73f11
@@ -139,7 +139,9 @@ MAIN:
|
||||
name = tag.Prefix + name
|
||||
}
|
||||
|
||||
tag.Env = tag.EnvPrefix + tag.Env
|
||||
if tag.Env != "" {
|
||||
tag.Env = tag.EnvPrefix + tag.Env
|
||||
}
|
||||
|
||||
// Nested structs are either commands or args, unless they implement the Mapper interface.
|
||||
if field.value.Kind() == reflect.Struct && (tag.Cmd || tag.Arg) && k.registry.ForValue(fv) == nil {
|
||||
|
||||
Reference in New Issue
Block a user