mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
Fix InputPrompt.test.tsx to be windows compatible (#4736)
This commit is contained in:
committed by
GitHub
parent
2e28bb90a0
commit
e9e2f55144
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user