@revturbine/cli 0.2.0 → 0.2.1
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/dist/cli.js +42 -13
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5333,19 +5333,48 @@ async function promptLine(question) {
|
|
|
5333
5333
|
rl.close();
|
|
5334
5334
|
}
|
|
5335
5335
|
}
|
|
5336
|
-
|
|
5337
|
-
const
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5336
|
+
function promptHidden(question) {
|
|
5337
|
+
const { stdin, stdout } = process;
|
|
5338
|
+
if (!stdin.isTTY) return promptLine(question);
|
|
5339
|
+
return new Promise((resolve) => {
|
|
5340
|
+
stdout.write(question);
|
|
5341
|
+
const wasRaw = stdin.isRaw;
|
|
5342
|
+
stdin.setRawMode(true);
|
|
5343
|
+
stdin.resume();
|
|
5344
|
+
stdin.setEncoding("utf8");
|
|
5345
|
+
let input = "";
|
|
5346
|
+
const cleanup = () => {
|
|
5347
|
+
stdin.removeListener("data", onData);
|
|
5348
|
+
stdin.setRawMode(wasRaw);
|
|
5349
|
+
stdin.pause();
|
|
5350
|
+
};
|
|
5351
|
+
const onData = (chunk) => {
|
|
5352
|
+
for (const ch of chunk) {
|
|
5353
|
+
const code = ch.charCodeAt(0);
|
|
5354
|
+
if (code === 13 || code === 10 || code === 4) {
|
|
5355
|
+
cleanup();
|
|
5356
|
+
stdout.write("\n");
|
|
5357
|
+
resolve(input.trim());
|
|
5358
|
+
return;
|
|
5359
|
+
}
|
|
5360
|
+
if (code === 3) {
|
|
5361
|
+
cleanup();
|
|
5362
|
+
stdout.write("\n");
|
|
5363
|
+
process.exit(130);
|
|
5364
|
+
}
|
|
5365
|
+
if (code === 127 || code === 8) {
|
|
5366
|
+
if (input.length > 0) {
|
|
5367
|
+
input = input.slice(0, -1);
|
|
5368
|
+
stdout.write("\b \b");
|
|
5369
|
+
}
|
|
5370
|
+
continue;
|
|
5371
|
+
}
|
|
5372
|
+
input += ch;
|
|
5373
|
+
stdout.write("*");
|
|
5374
|
+
}
|
|
5375
|
+
};
|
|
5376
|
+
stdin.on("data", onData);
|
|
5377
|
+
});
|
|
5349
5378
|
}
|
|
5350
5379
|
program.command("signup").description("Create a RevTurbine account and log in (email + password + emailed verification code).").argument("[url]", `RevTurbine instance URL (default: ${DEFAULT_URL})`).option("--name <name>", "Full name (prompted if omitted)").option("--email <email>", "Email address (prompted if omitted)").option("--password <password>", "Password, min 8 chars (prompted hidden if omitted)").action(async (url, opts) => {
|
|
5351
5380
|
const baseUrl = normalizeBaseUrl(url ?? DEFAULT_URL);
|
package/package.json
CHANGED