Skip to content

Commit 288cf92

Browse files
committed
fix(cli): skip startup animation for non-interactive commands
(cherry picked from commit 957e6e6)
1 parent 6967131 commit 288cf92

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

packages/cli/src/gemini.tsx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,52 @@ async function askUserForUpdate(): Promise<boolean> {
217217
// -------------------------------------------------------------------------
218218
let startupTimer: NodeJS.Timeout | null = null;
219219

220+
/**
221+
* Check if the current command is a non-interactive command that should skip the startup animation.
222+
* This is a quick check based on process.argv before full argument parsing.
223+
*/
224+
function isNonInteractiveCommand(): boolean {
225+
const args = process.argv.slice(2);
226+
227+
// Skip animation for subcommands like "checkpoint clean"
228+
const nonInteractiveCommands = ['checkpoint', 'cp'];
229+
if (args.length > 0 && nonInteractiveCommands.includes(args[0])) {
230+
return true;
231+
}
232+
233+
// Skip animation for --cloud-mode flag
234+
if (args.includes('--cloud-mode')) {
235+
return true;
236+
}
237+
238+
// Skip animation for explicit non-interactive flags
239+
if (args.includes('--output-format') || args.includes('-p') || args.includes('--prompt')) {
240+
return true;
241+
}
242+
243+
// Skip animation for --help and --version
244+
if (args.includes('-h') || args.includes('--help') || args.includes('-v') || args.includes('--version')) {
245+
return true;
246+
}
247+
248+
// Skip animation for --update flag (it has its own output)
249+
if (args.includes('-u') || args.includes('--update')) {
250+
return true;
251+
}
252+
253+
return false;
254+
}
255+
220256
function startStartupAnimation() {
221257
if (!process.stdout.isTTY || process.env.CI || process.env.DEEPV_SILENT_MODE === 'true' || process.env.NO_COLOR) {
222258
return;
223259
}
224260

261+
// Skip animation for non-interactive commands
262+
if (isNonInteractiveCommand()) {
263+
return;
264+
}
265+
225266
let count = 0;
226267
const maxChars = 20; // Maximum number of '=' chars
227268

0 commit comments

Comments
 (0)