Merge pull request #32364 from aaronlehmann/preserve-env-order
cli: Preserve order of environment variables
This commit is contained in:
commit
f5d881b835
1 changed files with 9 additions and 8 deletions
|
@ -524,20 +524,21 @@ func updateLabels(flags *pflag.FlagSet, field *map[string]string) {
|
|||
}
|
||||
|
||||
func updateEnvironment(flags *pflag.FlagSet, field *[]string) {
|
||||
envSet := map[string]string{}
|
||||
for _, v := range *field {
|
||||
envSet[envKey(v)] = v
|
||||
}
|
||||
if flags.Changed(flagEnvAdd) {
|
||||
envSet := map[string]string{}
|
||||
for _, v := range *field {
|
||||
envSet[envKey(v)] = v
|
||||
}
|
||||
|
||||
value := flags.Lookup(flagEnvAdd).Value.(*opts.ListOpts)
|
||||
for _, v := range value.GetAll() {
|
||||
envSet[envKey(v)] = v
|
||||
}
|
||||
}
|
||||
|
||||
*field = []string{}
|
||||
for _, v := range envSet {
|
||||
*field = append(*field, v)
|
||||
*field = []string{}
|
||||
for _, v := range envSet {
|
||||
*field = append(*field, v)
|
||||
}
|
||||
}
|
||||
|
||||
toRemove := buildToRemoveSet(flags, flagEnvRemove)
|
||||
|
|
Loading…
Reference in a new issue