@@ -7,7 +7,7 @@ import { Completion } from './index';
77import {
88 CompletionConfig ,
99 noopHandler ,
10- requireDashDashSeparator ,
10+ assertDoubleDashes ,
1111} from './shared' ;
1212
1313const execPath = process . execPath ;
@@ -89,23 +89,25 @@ export default async function tab(
8989 break ;
9090 }
9191 default : {
92- if ( ! requireDashDashSeparator ( instance . name ) ) {
93- return ;
94- }
92+ try {
93+ assertDoubleDashes ( instance . name ) ;
9594
96- const args : string [ ] = extra [ '--' ] || [ ] ;
97- instance . showHelpOnExit = false ;
95+ const args : string [ ] = extra [ '--' ] || [ ] ;
96+ instance . showHelpOnExit = false ;
9897
99- // Parse current command context
100- instance . unsetMatchedCommand ( ) ;
101- instance . parse ( [ execPath , processArgs [ 0 ] , ...args ] , {
102- run : false ,
103- } ) ;
98+ // Parse current command context
99+ instance . unsetMatchedCommand ( ) ;
100+ instance . parse ( [ execPath , processArgs [ 0 ] , ...args ] , {
101+ run : false ,
102+ } ) ;
104103
105- // const matchedCommand = instance.matchedCommand?.name || '';
106- // const potentialCommand = args.join(' ')
107- // console.log(potentialCommand)
108- return completion . parse ( args ) ;
104+ // const matchedCommand = instance.matchedCommand?.name || '';
105+ // const potentialCommand = args.join(' ')
106+ // console.log(potentialCommand)
107+ return completion . parse ( args ) ;
108+ } catch ( error ) {
109+ return ;
110+ }
109111 }
110112 }
111113 } ) ;
0 commit comments