File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -487,7 +487,7 @@ function parse (args, opts) {
487487 } else {
488488 // setting arguments via CLI takes precedence over
489489 // values within the config file.
490- if ( ! hasKey ( argv , fullKey . split ( '.' ) ) || ( flags . defaulted [ fullKey ] ) ) {
490+ if ( ! hasKey ( argv , fullKey . split ( '.' ) ) || ( flags . defaulted [ fullKey ] ) || ( flags . arrays [ fullKey ] ) ) {
491491 setArg ( fullKey , value )
492492 }
493493 }
Original file line number Diff line number Diff line change @@ -450,6 +450,18 @@ describe('yargs-parser', function () {
450450 argv . should . have . property ( 'foo' ) . and . deep . equal ( 'baz' )
451451 } )
452452
453+ it ( 'should combine values from config file and argv, if argv value is an array' , function ( ) {
454+ var argv = parser ( [ '--foo' , 'bar' ] , {
455+ config : [ 'settings' ] ,
456+ array : [ 'foo' ] ,
457+ default : {
458+ settings : jsonPath
459+ }
460+ } )
461+
462+ argv . should . have . property ( 'foo' ) . and . deep . equal ( [ 'bar' , 'baz' ] )
463+ } )
464+
453465 it ( 'should use value from config file, if argv key is a boolean' , function ( ) {
454466 var argv = parser ( [ ] , {
455467 config : [ 'settings' ] ,
You can’t perform that action at this time.
0 commit comments