mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-14 23:31:13 -07:00
feat(cli): undeprecate the --prompt flag (#13981)
Co-authored-by: Allen Hutchison <adh@google.com>
This commit is contained in:
committed by
GitHub
parent
fb7640886b
commit
a2dab146b9
@@ -1418,58 +1418,6 @@ describe('runNonInteractive', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should display a deprecation warning if hasDeprecatedPromptArg is true', async () => {
|
||||
const events: ServerGeminiStreamEvent[] = [
|
||||
{ type: GeminiEventType.Content, value: 'Final Answer' },
|
||||
{
|
||||
type: GeminiEventType.Finished,
|
||||
value: { reason: undefined, usageMetadata: { totalTokenCount: 10 } },
|
||||
},
|
||||
];
|
||||
mockGeminiClient.sendMessageStream.mockReturnValue(
|
||||
createStreamFromEvents(events),
|
||||
);
|
||||
|
||||
await runNonInteractive({
|
||||
config: mockConfig,
|
||||
settings: mockSettings,
|
||||
input: 'Test input',
|
||||
prompt_id: 'prompt-id-deprecated',
|
||||
hasDeprecatedPromptArg: true,
|
||||
});
|
||||
|
||||
expect(processStderrSpy).toHaveBeenCalledWith(
|
||||
'The --prompt (-p) flag has been deprecated and will be removed in a future version. Please use a positional argument for your prompt. See gemini --help for more information.\n',
|
||||
);
|
||||
expect(processStdoutSpy).toHaveBeenCalledWith('Final Answer');
|
||||
});
|
||||
|
||||
it('should display a deprecation warning for JSON format', async () => {
|
||||
const events: ServerGeminiStreamEvent[] = [
|
||||
{ type: GeminiEventType.Content, value: 'Final Answer' },
|
||||
{
|
||||
type: GeminiEventType.Finished,
|
||||
value: { reason: undefined, usageMetadata: { totalTokenCount: 10 } },
|
||||
},
|
||||
];
|
||||
mockGeminiClient.sendMessageStream.mockReturnValue(
|
||||
createStreamFromEvents(events),
|
||||
);
|
||||
vi.mocked(mockConfig.getOutputFormat).mockReturnValue(OutputFormat.JSON);
|
||||
|
||||
await runNonInteractive({
|
||||
config: mockConfig,
|
||||
settings: mockSettings,
|
||||
input: 'Test input',
|
||||
prompt_id: 'prompt-id-deprecated-json',
|
||||
hasDeprecatedPromptArg: true,
|
||||
});
|
||||
|
||||
const deprecateText =
|
||||
'The --prompt (-p) flag has been deprecated and will be removed in a future version. Please use a positional argument for your prompt. See gemini --help for more information.\n';
|
||||
expect(processStderrSpy).toHaveBeenCalledWith(deprecateText);
|
||||
});
|
||||
|
||||
it('should emit appropriate events for streaming JSON output', async () => {
|
||||
vi.mocked(mockConfig.getOutputFormat).mockReturnValue(
|
||||
OutputFormat.STREAM_JSON,
|
||||
|
||||
Reference in New Issue
Block a user