File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -280,14 +280,22 @@ async function configCommand(): Promise<number> {
280280}
281281
282282async function main ( argv : string [ ] ) : Promise < number > {
283- const [ cmd , ...rest ] = argv ;
283+ const positional = argv . filter ( ( a ) => ! a . startsWith ( '--' ) ) ;
284+ const [ cmd , ...rest ] = positional ;
284285
285- if ( ! cmd || cmd === '--help' || cmd === '- h' || cmd === 'help' ) {
286+ if ( ! cmd || cmd === '-h' || cmd === 'help' ) {
286287 console . log ( USAGE ) ;
287288 return 0 ;
288289 }
289290
290- if ( cmd === '--version' || cmd === '-v' || cmd === '-V' ) {
291+ if ( cmd === '-v' || cmd === '-V' ) {
292+ const pkg = await import ( '../../../package.json' ) ;
293+ console . log ( pkg . version ?? '0.0.0' ) ;
294+ return 0 ;
295+ }
296+
297+ if ( argv . includes ( '--help' ) ) { console . log ( USAGE ) ; return 0 ; }
298+ if ( argv . includes ( '--version' ) ) {
291299 const pkg = await import ( '../../../package.json' ) ;
292300 console . log ( pkg . version ?? '0.0.0' ) ;
293301 return 0 ;
You can’t perform that action at this time.
0 commit comments