MCPcopy Create free account
hub / github.com/Effect-TS/effect / basePrompt

Function basePrompt

packages/effect/src/cli/Prompt.ts:4003–4024  ·  view source on GitHub ↗
(
  options: TextOptions,
  type: TextOptionsReq["type"]
)

Source from the content-addressed store, hash-verified

4001}
4002
4003const basePrompt = (
4004 options: TextOptions,
4005 type: TextOptionsReq["type"]
4006): Prompt<string> => {
4007 const opts: TextOptionsReq = {
4008 default: "",
4009 type,
4010 validate: Effect.succeed,
4011 ...options
4012 }
4013
4014 const initialState: TextState = {
4015 cursor: opts.default.length,
4016 value: opts.default,
4017 error: Option.none()
4018 }
4019 return Custom(initialState, {
4020 render: handleTextRender(opts),
4021 process: handleTextProcess(opts),
4022 clear: handleTextClear(opts)
4023 })
4024}
4025
4026interface ToggleOptionsReq extends OptionsReq<ToggleOptions> {}
4027

Callers 3

HiddenFunction · 0.85
PasswordFunction · 0.85
StringFunction · 0.85

Calls 4

handleTextRenderFunction · 0.85
handleTextProcessFunction · 0.85
handleTextClearFunction · 0.85
CustomFunction · 0.70

Tested by

no test coverage detected