File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,7 +58,6 @@ import {
5858
5959import { loadSandboxConfig } from './sandboxConfig.js' ;
6060import { resolvePath } from '../utils/resolvePath.js' ;
61- import { runExitCleanup } from '../utils/cleanup.js' ;
6261import { isRecord } from '../utils/settingsUtils.js' ;
6362import { RESUME_LATEST } from '../utils/sessionUtils.js' ;
6463
@@ -83,6 +82,9 @@ export interface CliArgs {
8382 promptInteractive : string | undefined ;
8483 worktree ?: string ;
8584
85+ help ?: boolean ;
86+ version ?: boolean ;
87+
8688 yolo : boolean | undefined ;
8789 approvalMode : string | undefined ;
8890 policy : string [ ] | undefined ;
@@ -522,17 +524,6 @@ export async function parseArguments(
522524 throw new FatalConfigError ( msg ) ;
523525 }
524526
525- // Handle help and version flags manually since we disabled exitProcess
526- if ( result [ 'help' ] || result [ 'version' ] ) {
527- if (
528- process . env [ 'VITEST' ] !== 'true' &&
529- process . env [ 'GEMINI_CLI_INTEGRATION_TEST' ] !== 'true'
530- ) {
531- await runExitCleanup ( ) ;
532- process . exit ( 0 ) ;
533- }
534- }
535-
536527 // Normalize query args: handle both quoted "@path file" and unquoted @path file
537528 const queryArg = result [ 'query' ] ;
538529 let q : string | undefined ;
Original file line number Diff line number Diff line change @@ -423,6 +423,17 @@ export async function main() {
423423
424424 const argv = await argvPromise ;
425425
426+ if ( argv . help || argv . version ) {
427+ if (
428+ process . env [ 'VITEST' ] === 'true' ||
429+ process . env [ 'GEMINI_CLI_INTEGRATION_TEST' ] === 'true'
430+ ) {
431+ return ;
432+ }
433+ await runExitCleanup ( ) ;
434+ process . exit ( 0 ) ;
435+ }
436+
426437 const { sessionId, resumedSessionData } = await resolveSessionId (
427438 argv . resume ,
428439 argv . sessionId ,
You can’t perform that action at this time.
0 commit comments