diff options
Diffstat (limited to 'packages/cli/src/ui/hooks')
| -rw-r--r-- | packages/cli/src/ui/hooks/useInputHistory.ts | 2 | ||||
| -rw-r--r-- | packages/cli/src/ui/hooks/useShellHistory.ts | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/packages/cli/src/ui/hooks/useInputHistory.ts b/packages/cli/src/ui/hooks/useInputHistory.ts index 8225d4fc..58fc9d4a 100644 --- a/packages/cli/src/ui/hooks/useInputHistory.ts +++ b/packages/cli/src/ui/hooks/useInputHistory.ts @@ -14,7 +14,7 @@ interface UseInputHistoryProps { onChange: (value: string) => void; } -interface UseInputHistoryReturn { +export interface UseInputHistoryReturn { handleSubmit: (value: string) => void; navigateUp: () => boolean; navigateDown: () => boolean; diff --git a/packages/cli/src/ui/hooks/useShellHistory.ts b/packages/cli/src/ui/hooks/useShellHistory.ts index 90248cc0..61c7207c 100644 --- a/packages/cli/src/ui/hooks/useShellHistory.ts +++ b/packages/cli/src/ui/hooks/useShellHistory.ts @@ -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); |
