MCPcopy
hub / github.com/Effect-TS/effect / handleProcess

Function handleProcess

packages/cli/src/internal/prompt/text.ts:259–291  ·  view source on GitHub ↗
(options: Options)

Source from the content-addressed store, hash-verified

257}
258
259function handleProcess(options: Options) {
260 return (input: Terminal.UserInput, state: State) => {
261 switch (input.key.name) {
262 case "backspace": {
263 return processBackspace(state)
264 }
265 case "left": {
266 return processCursorLeft(state)
267 }
268 case "right": {
269 return processCursorRight(state)
270 }
271 case "enter":
272 case "return": {
273 const value = getValue(state, options)
274 return Effect.match(options.validate(value), {
275 onFailure: (error) =>
276 Action.NextFrame({
277 state: { ...state, value, error: Option.some(error) }
278 }),
279 onSuccess: (value) => Action.Submit({ value })
280 })
281 }
282 case "tab": {
283 return processTab(state, options)
284 }
285 default: {
286 const value = Option.getOrElse(input.input, () => "")
287 return defaultProcessor(value, state)
288 }
289 }
290 }
291}
292
293function handleClear(options: Options) {
294 return (state: State, _: Prompt.Prompt.Action<State, string>) => {

Callers 1

basePromptFunction · 0.70

Calls 7

getValueFunction · 0.85
processTabFunction · 0.85
validateMethod · 0.80
processBackspaceFunction · 0.70
processCursorLeftFunction · 0.70
processCursorRightFunction · 0.70
defaultProcessorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…