(options: ConfirmOptions)
| 743 | * @since 4.0.0 |
| 744 | */ |
| 745 | export 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. |
nothing calls this directly
no test coverage detected