@kiyeonjeon21/ncli 0.1.5 → 0.1.7
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/commands/init.js +10 -9
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -4,17 +4,18 @@ import { createInterface } from "readline";
|
|
|
4
4
|
import { NCLI_DIR, NCLI_ENV_PATH, loadConfig } from "../core/config.js";
|
|
5
5
|
import { printJson } from "../core/output.js";
|
|
6
6
|
function prompt(question, mask = false) {
|
|
7
|
-
|
|
8
|
-
process.stderr
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
rl.question("", (answer) => {
|
|
7
|
+
if (!mask) {
|
|
8
|
+
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
9
|
+
return new Promise((resolve) => {
|
|
10
|
+
rl.question(question, (answer) => {
|
|
12
11
|
rl.close();
|
|
13
12
|
resolve(answer.trim());
|
|
14
13
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
// Masked input
|
|
17
|
+
return new Promise((resolve) => {
|
|
18
|
+
process.stderr.write(question);
|
|
18
19
|
const stdin = process.stdin;
|
|
19
20
|
const wasRaw = stdin.isRaw;
|
|
20
21
|
if (stdin.isTTY)
|
|
@@ -75,7 +76,7 @@ export const initCommand = new Command("init")
|
|
|
75
76
|
process.stderr.write(" Register an app at: https://developers.naver.com/apps/\n");
|
|
76
77
|
process.stderr.write(" Select APIs: Search, DataLab, etc.\n");
|
|
77
78
|
process.stderr.write(" Web service URL: http://localhost\n\n");
|
|
78
|
-
const clientId = await prompt(" Client ID: "
|
|
79
|
+
const clientId = await prompt(" Client ID: ");
|
|
79
80
|
if (!clientId) {
|
|
80
81
|
process.stderr.write(" Aborted — no Client ID provided.\n");
|
|
81
82
|
process.exit(1);
|