mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
fix(cli): always show shell command description or actual command (#24774)
This commit is contained in:
@@ -803,6 +803,32 @@ describe('ShellTool', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('invocation getDescription', () => {
|
||||||
|
it('should return the description if it is present and not empty whitespace', () => {
|
||||||
|
const invocation = shellTool.build({
|
||||||
|
command: 'echo hello',
|
||||||
|
description: 'prints hello',
|
||||||
|
});
|
||||||
|
expect(invocation.getDescription()).toBe('prints hello');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the raw command if description is an empty string', () => {
|
||||||
|
const invocation = shellTool.build({
|
||||||
|
command: 'echo hello',
|
||||||
|
description: '',
|
||||||
|
});
|
||||||
|
expect(invocation.getDescription()).toBe('echo hello');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the raw command if description is just whitespace', () => {
|
||||||
|
const invocation = shellTool.build({
|
||||||
|
command: 'echo hello',
|
||||||
|
description: ' ',
|
||||||
|
});
|
||||||
|
expect(invocation.getDescription()).toBe('echo hello');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('llmContent output format', () => {
|
describe('llmContent output format', () => {
|
||||||
const mockAbortSignal = new AbortController().signal;
|
const mockAbortSignal = new AbortController().signal;
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,9 @@ export class ShellToolInvocation extends BaseToolInvocation<
|
|||||||
}
|
}
|
||||||
|
|
||||||
getDescription(): string {
|
getDescription(): string {
|
||||||
return this.params.description || '';
|
return this.params.description?.trim()
|
||||||
|
? this.params.description
|
||||||
|
: this.params.command;
|
||||||
}
|
}
|
||||||
|
|
||||||
private simplifyPaths(paths: Set<string>): string[] {
|
private simplifyPaths(paths: Set<string>): string[] {
|
||||||
|
|||||||
Reference in New Issue
Block a user