@vexify-org/yaggs 6.11.0 → 6.12.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 +44 -0
- package/package.json +1 -1
package/index.js
CHANGED
package/lib/parser.js
CHANGED
|
@@ -1011,6 +1011,50 @@ complete -c ${this.scriptName} `;
|
|
|
1011
1011
|
});
|
|
1012
1012
|
}
|
|
1013
1013
|
|
|
1014
|
+
async password(message = 'Enter password') {
|
|
1015
|
+
const readline = require('readline');
|
|
1016
|
+
const rl = readline.createInterface({
|
|
1017
|
+
input: process.stdin,
|
|
1018
|
+
output: process.stdout,
|
|
1019
|
+
terminal: true
|
|
1020
|
+
});
|
|
1021
|
+
|
|
1022
|
+
return new Promise((resolve) => {
|
|
1023
|
+
const stdin = process.stdin;
|
|
1024
|
+
const stdout = process.stdout;
|
|
1025
|
+
|
|
1026
|
+
stdin.setRawMode(true);
|
|
1027
|
+
|
|
1028
|
+
let password = '';
|
|
1029
|
+
|
|
1030
|
+
stdout.write(`\u001b[34m${message}:\u001b[0m `);
|
|
1031
|
+
|
|
1032
|
+
const onData = (data) => {
|
|
1033
|
+
const char = data.toString('utf8');
|
|
1034
|
+
|
|
1035
|
+
if (char === '\n' || char === '\r') {
|
|
1036
|
+
stdin.setRawMode(false);
|
|
1037
|
+
stdout.write('\n');
|
|
1038
|
+
stdin.removeListener('data', onData);
|
|
1039
|
+
rl.close();
|
|
1040
|
+
resolve(password);
|
|
1041
|
+
} else if (char === '\u0008' || char === '\u007f') {
|
|
1042
|
+
if (password.length > 0) {
|
|
1043
|
+
password = password.slice(0, -1);
|
|
1044
|
+
stdout.write('\u0008 \u0008');
|
|
1045
|
+
}
|
|
1046
|
+
} else if (char.charCodeAt(0) === 3) {
|
|
1047
|
+
process.exit(1);
|
|
1048
|
+
} else {
|
|
1049
|
+
password += char;
|
|
1050
|
+
stdout.write('*');
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
|
|
1054
|
+
stdin.on('data', onData);
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1014
1058
|
getHelp() {
|
|
1015
1059
|
let help = `\u001b[36m${this.scriptName}\u001b[0m`;
|
|
1016
1060
|
|