@gabrielvgx/tecfoodcli
Version:
Projeto para automatizar criação de ambientes TecFood
64 lines (53 loc) • 1.5 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.text = exports.password = exports.default = exports.confirm = void 0;
var _prompts = _interopRequireDefault(require("prompts"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const templateOption = {
async confirm(message, defaultValue = true, onlyOptions = false) {
if (!defaultValue && defaultValue !== false && defaultValue !== 0) defaultValue = true;
let options = {
type: 'confirm',
name: 'value',
message,
initial: defaultValue
};
if (onlyOptions) {
return Promise.resolve(options);
}
return await (0, _prompts.default)(options);
},
async text(message, defaultValue = "Empty", onlyOptions = false) {
if (!defaultValue && defaultValue !== false && defaultValue !== 0) defaultValue = "Empty";
let options = {
type: 'text',
name: 'value',
message,
initial: defaultValue
};
if (onlyOptions) {
return options;
}
return await (0, _prompts.default)(options);
},
async password(message = "Password") {
let options = {
type: 'password',
name: 'value',
message
};
return await (0, _prompts.default)(options);
}
};
const {
confirm,
text,
password
} = templateOption;
exports.password = password;
exports.text = text;
exports.confirm = confirm;
var _default = templateOption;
exports.default = _default;