@@ -266,7 +266,7 @@ public static function setOption($optionName = "", $optionValue = "") {
266266 }
267267
268268 $ arrayFinder = new ArrayFinder (self ::$ options );
269- $ arrayFinder ->set ($ key , $ value );
269+ $ arrayFinder ->set ($ optionName , $ optionValue );
270270 self ::$ options = $ arrayFinder ->get ();
271271
272272 }
@@ -323,7 +323,8 @@ public static function updateConfigOption($optionName,$optionValue, $force = fal
323323 } else if (self ::$ options ["overrideConfig " ] == "q " ) {
324324
325325 // standardize the values for comparison
326- $ currentOptionValue = is_array (self ::$ options [$ optionName ]) ? implode (", " ,self ::$ options [$ optionName ]) : self ::$ options [$ optionName ];
326+ $ currentOption = self ::getOption ($ optionName );
327+ $ currentOptionValue = is_array ($ currentOption ) ? implode (", " ,$ currentOption ) : $ currentOption ;
327328 $ newOptionValue = is_array ($ optionValue ) ? implode (", " ,$ optionValue ) : $ optionValue ;
328329
329330 if ($ currentOptionValue != $ newOptionValue ) {
@@ -373,18 +374,11 @@ protected static function writeUpdateConfigOption($optionName,$optionValue) {
373374 Console::writeError ("Config parse error in <path> " .self ::$ userConfigPath ."</path>: " .$ e ->getMessage ());
374375 }
375376
376- if (isset ($ options [$ optionName ]) && is_array ($ options [$ optionName ])) {
377- $ optionValue = is_array ($ optionValue ) ? $ optionValue : array ($ optionValue );
378- $ options [$ optionName ] = array_merge ($ options [$ optionName ], $ optionValue );
379- } else {
380- $ options [$ optionName ] = $ optionValue ;
381- }
382-
383- // reload the options
384- self ::$ options = $ options ;
377+ print "foo " .$ optionName ." " .$ optionValue ;
378+ self ::setOption ($ optionName , $ optionValue );
385379
386380 // dump the YAML
387- $ configOutput = Yaml::dump ($ options , 3 );
381+ $ configOutput = Yaml::dump (self :: $ options , 3 );
388382
389383 // write out the new config file
390384 file_put_contents (self ::$ userConfigPath ,$ configOutput );
0 commit comments