MCPcopy Create free account
hub / github.com/github/spec-kit / get_key

Function get_key

src/specify_cli/_console.py:127–145  ·  view source on GitHub ↗

Get a single keypress in a cross-platform way using readchar.

()

Source from the content-addressed store, hash-verified

125
126
127def get_key():
128 """Get a single keypress in a cross-platform way using readchar."""
129 key = readchar.readkey()
130
131 if key == readchar.key.UP or key == readchar.key.CTRL_P:
132 return 'up'
133 if key == readchar.key.DOWN or key == readchar.key.CTRL_N:
134 return 'down'
135
136 if key == readchar.key.ENTER:
137 return 'enter'
138
139 if key == readchar.key.ESC:
140 return 'escape'
141
142 if key == readchar.key.CTRL_C:
143 raise KeyboardInterrupt
144
145 return key
146
147def select_with_arrows(
148 options: dict[str, str],

Callers 1

run_selection_loopFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected