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

Function confirm

packages/effect/src/unstable/cli/Prompt.ts:745–766  ·  view source on GitHub ↗
(options: ConfirmOptions)

Source from the content-addressed store, hash-verified

743 * @since 4.0.0
744 */
745export const confirm = (options: ConfirmOptions): Prompt<boolean> => {
746 const opts: Required<ConfirmOptions> = {
747 initial: false,
748 ...options,
749 label: {
750 confirm: "yes",
751 deny: "no",
752 ...options.label
753 },
754 placeholder: {
755 defaultConfirm: "(Y/n)",
756 defaultDeny: "(y/N)",
757 ...options.placeholder
758 }
759 }
760 const initialState: ConfirmState = { value: opts.initial }
761 return custom(initialState, {
762 render: handleConfirmRender(opts),
763 process: (input) => handleConfirmProcess(input, opts.initial),
764 clear: handleConfirmClear(opts)
765 })
766}
767
768/**
769 * Creates a custom `Prompt` from the specified initial state and handlers.

Callers

nothing calls this directly

Calls 4

handleConfirmRenderFunction · 0.85
handleConfirmProcessFunction · 0.85
handleConfirmClearFunction · 0.85
customFunction · 0.70

Tested by

no test coverage detected