mirror of
https://gitverse.ru/anarchic/claude-code
synced 2026-05-03 06:50:42 +00:00
new initial commit (history rewritten)
This commit is contained in:
commit
c1996f2e3b
1907 changed files with 514172 additions and 0 deletions
33
components/PromptInput/inputModes.ts
Normal file
33
components/PromptInput/inputModes.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import 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 === '!'
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue