added function for making more confirm schemas

pull/51/head
tycrek 3 years ago
parent 8a443b1787
commit 55880b9558
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -179,19 +179,7 @@ function doSetup() {
};
// Schema for confirm prompt. User must enter 'y' or 'n' (case-insensitive)
const confirmSchema = {
properties: {
confirm: {
description: '\nIs the above information correct? (y/n)',
type: 'string',
pattern: /^[y|n]/gim,
message: 'Must respond with either \'y\' or \'n\'',
default: 'y',
required: false,
before: (value) => value.toLowerCase().startsWith('y')
}
}
};
const confirmSchema = getConfirmSchema('\nIs the above information correct? (y/n)');
log.blank().blank().blank().blank()
.info('<<< ass setup >>>').blank();
@ -247,6 +235,22 @@ function doSetup() {
.catch((err) => log.blank().error(err));
}
function getConfirmSchema(description) {
return {
properties: {
confirm: {
description,
type: 'string',
pattern: /^[y|n]/gim,
message: 'Must respond with either \'y\' or \'n\'',
default: 'y',
required: false,
before: (value) => value.toLowerCase().startsWith('y')
}
}
};
}
module.exports = {
doSetup,
config

Loading…
Cancel
Save