@vexify-org/yaggs 6.9.0 → 6.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +4 -0
- package/lib/parser.js +26 -0
- package/package.json +1 -1
package/index.js
CHANGED
package/lib/parser.js
CHANGED
|
@@ -950,6 +950,32 @@ complete -c ${this.scriptName} `;
|
|
|
950
950
|
return { stop };
|
|
951
951
|
}
|
|
952
952
|
|
|
953
|
+
async confirm(message, options = {}) {
|
|
954
|
+
const readline = require('readline');
|
|
955
|
+
const rl = readline.createInterface({
|
|
956
|
+
input: process.stdin,
|
|
957
|
+
output: process.stdout
|
|
958
|
+
});
|
|
959
|
+
|
|
960
|
+
return new Promise((resolve) => {
|
|
961
|
+
const defaultValue = options.default !== undefined ? (options.default ? 'Y/n' : 'y/N') : 'y/N';
|
|
962
|
+
|
|
963
|
+
rl.question(`\u001b[33m${message} [${defaultValue}]:\u001b[0m `, (input) => {
|
|
964
|
+
const answer = input.trim().toLowerCase();
|
|
965
|
+
|
|
966
|
+
let result;
|
|
967
|
+
if (answer === '') {
|
|
968
|
+
result = options.default !== undefined ? options.default : false;
|
|
969
|
+
} else {
|
|
970
|
+
result = ['yes', 'y', 'true', '1'].includes(answer);
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
rl.close();
|
|
974
|
+
resolve(result);
|
|
975
|
+
});
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
|
|
953
979
|
getHelp() {
|
|
954
980
|
let help = `\u001b[36m${this.scriptName}\u001b[0m`;
|
|
955
981
|
|