Fix InputPrompt.test.tsx to be windows compatible (#4736)

This commit is contained in:
Tommaso Sciortino
2025-07-23 15:49:09 -07:00
committed by GitHub
parent 2e28bb90a0
commit e9e2f55144
4 changed files with 94 additions and 53 deletions

View File

@@ -14,7 +14,7 @@ interface UseInputHistoryProps {
onChange: (value: string) => void;
}
interface UseInputHistoryReturn {
export interface UseInputHistoryReturn {
handleSubmit: (value: string) => void;
navigateUp: () => boolean;
navigateDown: () => boolean;

View File

@@ -12,6 +12,13 @@ import { isNodeError, getProjectTempDir } from '@google/gemini-cli-core';
const HISTORY_FILE = 'shell_history';
const MAX_HISTORY_LENGTH = 100;
export interface UseShellHistoryReturn {
addCommandToHistory: (command: string) => void;
getPreviousCommand: () => string | null;
getNextCommand: () => string | null;
resetHistoryPosition: () => void;
}
async function getHistoryFilePath(projectRoot: string): Promise<string> {
const historyDir = getProjectTempDir(projectRoot);
return path.join(historyDir, HISTORY_FILE);
@@ -42,7 +49,7 @@ async function writeHistoryFile(
}
}
export function useShellHistory(projectRoot: string) {
export function useShellHistory(projectRoot: string): UseShellHistoryReturn {
const [history, setHistory] = useState<string[]>([]);
const [historyIndex, setHistoryIndex] = useState(-1);
const [historyFilePath, setHistoryFilePath] = useState<string | null>(null);