File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -480,7 +480,11 @@ function parse (args, opts) {
480480 a . shift ( ) // nuke the old key.
481481 x = x . concat ( a )
482482
483- setKey ( argv , x , value )
483+ // populate alias only if is not already an alias of the full key
484+ // (already populated above)
485+ if ( ! ( flags . aliases [ key ] || [ ] ) . includes ( x . join ( '.' ) ) ) {
486+ setKey ( argv , x , value )
487+ }
484488 } )
485489 }
486490
Original file line number Diff line number Diff line change @@ -959,6 +959,20 @@ describe('yargs-parser', function () {
959959 } )
960960
961961 argv . f . bar . should . eql ( 99 )
962+ argv . foo . bar . should . eql ( 99 )
963+ } )
964+
965+ // see #267
966+ it ( 'should populate aliases when dot notation is used on camel-cased option' , function ( ) {
967+ var argv = parser ( [ '--foo-baz.bar' , '99' ] , {
968+ alias : {
969+ 'foo-baz' : [ 'f' ]
970+ }
971+ } )
972+
973+ argv . f . bar . should . eql ( 99 )
974+ argv [ 'foo-baz' ] . bar . should . eql ( 99 )
975+ argv . fooBaz . bar . should . eql ( 99 )
962976 } )
963977
964978 it ( 'should populate aliases when nested dot notation is used' , function ( ) {
You can’t perform that action at this time.
0 commit comments