You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.3 KiB
36 lines
1.3 KiB
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.Confirm = exports.InputValidate = exports.Input = exports.List = void 0;
|
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
function List(self, name, message, choices, defaultChoice, skip = false) {
|
|
if (skip) {
|
|
return { [name]: defaultChoice };
|
|
}
|
|
return self.prompt([{ choices, message, name, type: 'list', default: defaultChoice }]);
|
|
}
|
|
exports.List = List;
|
|
function Input(self, name, message, defaultChoice, skip = false) {
|
|
if (skip) {
|
|
return { [name]: defaultChoice };
|
|
}
|
|
return self.prompt([{ default: defaultChoice, message, name, type: 'input' }]);
|
|
}
|
|
exports.Input = Input;
|
|
function InputValidate(self, name, message, cb, defaultChoice, skip = false) {
|
|
if (skip) {
|
|
return { [name]: defaultChoice };
|
|
}
|
|
const input = { message, name, type: 'input', validate: cb };
|
|
if (defaultChoice) {
|
|
input.default = defaultChoice;
|
|
}
|
|
return self.prompt([input]);
|
|
}
|
|
exports.InputValidate = InputValidate;
|
|
function Confirm(self, name, message, defaultChoice = true, skip = false) {
|
|
if (skip) {
|
|
return { [name]: defaultChoice };
|
|
}
|
|
return self.prompt([{ default: defaultChoice, message, name, type: 'confirm' }]);
|
|
}
|
|
exports.Confirm = Confirm;
|
|
|