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

Function handleDateClear

packages/effect/src/unstable/cli/Prompt.ts:1551–1568  ·  view source on GitHub ↗
(options: DateOptionsReq)

Source from the content-addressed store, hash-verified

1549}
1550
1551const handleDateClear = (options: DateOptionsReq) => {
1552 return Effect.fnUntraced(function*(state: DateState, _: Action<DateState, globalThis.Date>) {
1553 const terminal = yield* Terminal.Terminal
1554 const columns = yield* terminal.columns
1555 const figures = yield* platformFigures
1556 const resetCurrentLine = Ansi.eraseLine + Ansi.cursorLeft
1557 const parts = Arr.reduce(state.dateParts, "", (doc, part) => doc + part.toString())
1558 const promptText = renderDateOutput("?", figures.pointerSmall, parts, options, { plain: true })
1559 const errorText = Option.isSome(state.error)
1560 ? Arr.match(state.error.value.split(NEWLINE_REGEXP), {
1561 onEmpty: () => "",
1562 onNonEmpty: (errorLines) => `${figures.pointerSmall} ${errorLines.join("\n")}`
1563 })
1564 : ""
1565 const clearOutput = clearOutputWithError(promptText, columns, errorText)
1566 return clearOutput + resetCurrentLine
1567 })
1568}
1569
1570const renderDateError = (state: DateState, pointer: string): string => {
1571 if (Option.isSome(state.error)) {

Callers 1

dateFunction · 0.85

Calls 5

renderDateOutputFunction · 0.85
clearOutputWithErrorFunction · 0.85
joinMethod · 0.80
toStringMethod · 0.65
splitMethod · 0.45

Tested by

no test coverage detected