File tree 2 files changed +19
-1
lines changed
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) {
480
480
a . shift ( ) // nuke the old key.
481
481
x = x . concat ( a )
482
482
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
+ }
484
488
} )
485
489
}
486
490
Original file line number Diff line number Diff line change @@ -959,6 +959,20 @@ describe('yargs-parser', function () {
959
959
} )
960
960
961
961
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 )
962
976
} )
963
977
964
978
it ( 'should populate aliases when nested dot notation is used' , function ( ) {
You can’t perform that action at this time.
0 commit comments