Something went wrong. Try again.
source dump of claude code forked from oppi.li/claude-code
Something went wrong. Try again.
731 B · 33 lines
TypeScript
at main
12345678910111213141516171819202122232425262728293031323334import type { HistoryMode } from 'src/hooks/useArrowKeyHistory.js'import type { PromptInputMode } from 'src/types/textInputTypes.js'
export function prependModeCharacterToInput( input: string, mode: PromptInputMode,): string { switch (mode) { case 'bash': return `!${input}` default: return input }}
export function getModeFromInput(input: string): HistoryMode { if (input.startsWith('!')) { return 'bash' } return 'prompt'}
export function getValueFromInput(input: string): string { const mode = getModeFromInput(input) if (mode === 'prompt') { return input } return input.slice(1)}
export function isInputModeCharacter(input: string): boolean { return input === '!'}