File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ export class Clerc<
225225 }
226226 : nameOrCommandObject ;
227227
228- const aliases = toArray ( options ?. alias ?? [ ] ) ;
228+ const aliases = toArray ( command ?. alias ?? [ ] ) ;
229229
230230 this . #callWithErrorHandler( ( ) =>
231231 this . #validateCommandNameAndAlias( command . name , aliases ) ,
Original file line number Diff line number Diff line change @@ -515,4 +515,19 @@ describe("cli", () => {
515515 } )
516516 . parse ( [ "foo" , "baz" ] ) ;
517517 } ) ;
518+
519+ it ( "should resolve alias from command object" , async ( ) => {
520+ await expect (
521+ TestBaseCli ( )
522+ . command ( {
523+ name : "foo" ,
524+ description : "foo" ,
525+ alias : "bar" ,
526+ handler : ( ctx ) => {
527+ expect ( ctx . command . name ) . toBe ( "foo" ) ;
528+ } ,
529+ } )
530+ . parse ( [ "bar" ] ) ,
531+ ) . resolves . not . toThrow ( ) ;
532+ } ) ;
518533} ) ;
You can’t perform that action at this time.
0 commit comments