File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ export function cli(pkg: any) {
111111
112112 if ( ! handlePreviewToggles ( args ) ) {
113113 // If this is a help command, load all commands so we can display them.
114- const isHelp = ! args . length || args [ 0 ] === "help" ;
114+ const isHelp = ! args . length || args [ 0 ] === "help" || ( args . length === 1 && args [ 0 ] === "ext" ) ;
115115 if ( isHelp ) {
116116 const seen = new Set ( ) ;
117117 const loadAll = ( obj : any ) => {
Original file line number Diff line number Diff line change @@ -34,6 +34,26 @@ const client: CLIClient = {
3434 return client . cli . commands [ i ] ;
3535 }
3636 }
37+ const keys = name . split ( ":" ) ;
38+ let obj : any = client ;
39+ for ( const key of keys ) {
40+ if ( ! obj || ( typeof obj !== "object" && typeof obj !== "function" ) ) {
41+ return ;
42+ }
43+ const nextKey = Object . keys ( obj ) . find ( ( k ) => k . toLowerCase ( ) === key . toLowerCase ( ) ) ;
44+ if ( ! nextKey ) {
45+ return ;
46+ }
47+ obj = obj [ nextKey ] ;
48+ }
49+ if ( isCommandModule ( obj ) ) {
50+ obj . load ( ) ;
51+ for ( let i = 0 ; i < client . cli . commands . length ; i ++ ) {
52+ if ( client . cli . commands [ i ] . _name === name ) {
53+ return client . cli . commands [ i ] ;
54+ }
55+ }
56+ }
3757 return ;
3858 } ,
3959} ;
@@ -82,7 +102,7 @@ program.action((_, args) => {
82102 let obj = client ;
83103 let hit = true ;
84104 for ( const key of keys ) {
85- if ( ! obj || typeof obj !== "object" ) {
105+ if ( ! obj || ( typeof obj !== "object" && typeof obj !== "function" ) ) {
86106 hit = false ;
87107 break ;
88108 }
You can’t perform that action at this time.
0 commit comments