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

Function handleConfirmClear

packages/effect/src/unstable/cli/Prompt.ts:1461–1480  ·  view source on GitHub ↗
(options: ConfirmOptionsReq)

Source from the content-addressed store, hash-verified

1459const NEWLINE_REGEXP = /\r?\n/
1460
1461const handleConfirmClear = (options: ConfirmOptionsReq) => {
1462 return Effect.fnUntraced(function*(state: ConfirmState, _: Action<ConfirmState, boolean>) {
1463 const terminal = yield* Terminal.Terminal
1464 const columns = yield* terminal.columns
1465 const figures = yield* platformFigures
1466 const confirmMessage = state.value
1467 ? options.placeholder.defaultConfirm!
1468 : options.placeholder.defaultDeny!
1469 const promptText = renderConfirmOutput(
1470 confirmMessage,
1471 "?",
1472 figures.pointerSmall,
1473 options,
1474 { plain: true }
1475 )
1476 const clearOutput = eraseText(promptText, columns)
1477 const resetCurrentLine = Ansi.eraseLine + Ansi.cursorLeft
1478 return clearOutput + resetCurrentLine
1479 })
1480}
1481
1482const renderConfirmOutput = (
1483 confirm: string,

Callers 1

confirmFunction · 0.85

Calls 2

renderConfirmOutputFunction · 0.85
eraseTextFunction · 0.85

Tested by

no test coverage detected