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

Function handleClear

packages/cli/src/internal/prompt/multi-select.ts:239–252  ·  view source on GitHub ↗
(options: SelectOptions<A>)

Source from the content-addressed store, hash-verified

237}
238
239export function handleClear<A>(options: SelectOptions<A>) {
240 return Effect.gen(function*() {
241 const terminal = yield* Terminal.Terminal
242 const columns = yield* terminal.columns
243 const clearPrompt = Doc.cat(Doc.eraseLine, Doc.cursorLeft)
244 const text = "\n".repeat(Math.min(options.choices.length + 2, options.maxPerPage)) + options.message + 1
245 const clearOutput = InternalAnsiUtils.eraseText(text, columns)
246 return clearOutput.pipe(
247 Doc.cat(clearPrompt),
248 Optimize.optimize(Optimize.Deep),
249 Doc.render({ style: "pretty", options: { lineWidth: columns } })
250 )
251 })
252}
253
254function handleProcess<A>(options: SelectOptions<A> & MultiSelectOptions) {
255 return (input: Terminal.UserInput, state: State) => {

Callers 1

multiSelectFunction · 0.70

Calls 1

pipeMethod · 0.65

Tested by

no test coverage detected