@@ -1032,11 +1032,7 @@ export class YargsInstance {
10321032 ) ;
10331033 this [ kFreeze ] ( ) ; // Push current state of parser onto stack.
10341034 if ( typeof args === 'undefined' ) {
1035- const argv = this [ kRunYargsParserAndExecuteCommands ] ( this . #processArgs) ;
1036- const tmpParsed = this . parsed ;
1037- this [ kUnfreeze ] ( ) ; // Pop the stack.
1038- this . parsed = tmpParsed ;
1039- return argv ;
1035+ args = this . #processArgs;
10401036 }
10411037
10421038 // a context object can optionally be provided, this allows
@@ -1063,6 +1059,7 @@ export class YargsInstance {
10631059 args ,
10641060 ! ! shortCircuit
10651061 ) ;
1062+ const tmpParsed = this . parsed ;
10661063 this . #completion! . setParsed ( this . parsed as DetailedArguments ) ;
10671064 if ( isPromise ( parsed ) ) {
10681065 return parsed
@@ -1082,10 +1079,12 @@ export class YargsInstance {
10821079 } )
10831080 . finally ( ( ) => {
10841081 this [ kUnfreeze ] ( ) ; // Pop the stack.
1082+ this . parsed = tmpParsed ;
10851083 } ) ;
10861084 } else {
10871085 if ( this . #parseFn) this . #parseFn( this . #exitError, parsed , this . #output) ;
10881086 this [ kUnfreeze ] ( ) ; // Pop the stack.
1087+ this . parsed = tmpParsed ;
10891088 }
10901089 return parsed ;
10911090 }
@@ -1983,7 +1982,6 @@ export class YargsInstance {
19831982 const handlerKeys = this . #command. getCommands ( ) ;
19841983 const requestCompletions = this . #completion! . completionKey in argv ;
19851984 const skipRecommendation = helpOptSet || requestCompletions || helpOnly ;
1986-
19871985 if ( argv . _ . length ) {
19881986 if ( handlerKeys . length ) {
19891987 let firstUnknownCommand ;
0 commit comments