File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed
Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,10 @@ func (s *OptionSet) Add(opt Option) error {
127127 }
128128 }
129129
130+ if ! opt .AcceptValue && len (opt .DefaultValues ) > 0 {
131+ opt .DefaultValues = nil
132+ }
133+
130134 option := & opt
131135
132136 // append
@@ -151,21 +155,23 @@ func (s *OptionSet) Add(opt Option) error {
151155 }
152156
153157 // redundant - env maps
154- if len (option .EnvVars ) > 0 {
155- for _ , envVar := range option .EnvVars {
156- if len (envVar ) == 0 {
157- continue
158- }
159- envValue , hasEnv := os .LookupEnv (envVar )
160- if ! hasEnv {
161- continue
162- }
158+ for _ , envVar := range option .EnvVars {
159+ if len (envVar ) == 0 {
160+ continue
161+ }
162+ envValue , hasEnv := os .LookupEnv (envVar )
163+ if ! hasEnv {
164+ continue
165+ }
163166
167+ if len (envValue ) > 0 {
164168 if option .MultiValues {
165169 s .keyEnvMap [option .Key ] = option .splitValues (envValue )
166170 } else {
167171 s .keyEnvMap [option .Key ] = []string {envValue }
168172 }
173+ } else {
174+ s .keyEnvMap [option .Key ] = []string {}
169175 }
170176 }
171177
You can’t perform that action at this time.
0 commit comments