MCPcopy Index your code
hub / github.com/codeaashu/claude-code / parseKeystroke

Function parseKeystroke

src/keybindings/parser.ts:13–75  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

11 * cmd/command/super/win).
12 */
13export function parseKeystroke(input: string): ParsedKeystroke {
14 const parts = input.split('+')
15 const keystroke: ParsedKeystroke = {
16 key: '',
17 ctrl: false,
18 alt: false,
19 shift: false,
20 meta: false,
21 super: false,
22 }
23 for (const part of parts) {
24 const lower = part.toLowerCase()
25 switch (lower) {
26 case 'ctrl':
27 case 'control':
28 keystroke.ctrl = true
29 break
30 case 'alt':
31 case 'opt':
32 case 'option':
33 keystroke.alt = true
34 break
35 case 'shift':
36 keystroke.shift = true
37 break
38 case 'meta':
39 keystroke.meta = true
40 break
41 case 'cmd':
42 case 'command':
43 case 'super':
44 case 'win':
45 keystroke.super = true
46 break
47 case 'esc':
48 keystroke.key = 'escape'
49 break
50 case 'return':
51 keystroke.key = 'enter'
52 break
53 case 'space':
54 keystroke.key = ' '
55 break
56 case '↑':
57 keystroke.key = 'up'
58 break
59 case '↓':
60 keystroke.key = 'down'
61 break
62 case '←':
63 keystroke.key = 'left'
64 break
65 case '→':
66 keystroke.key = 'right'
67 break
68 default:
69 keystroke.key = lower
70 break

Callers 3

parseChordFunction · 0.85
validateKeystrokeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected