moomodding 2.0.0 → 2.0.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 +1 -1
- package/dist/commands/login.js +44 -45
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -18,7 +18,7 @@ const program = new Command();
|
|
|
18
18
|
program
|
|
19
19
|
.name("moo")
|
|
20
20
|
.description("MooModding Developer CLI — Build, test, and sync MooMoo.io mods with zero friction.")
|
|
21
|
-
.version("2.0.
|
|
21
|
+
.version("2.0.1");
|
|
22
22
|
// 1. Auth Commands
|
|
23
23
|
program
|
|
24
24
|
.command("login [token]")
|
package/dist/commands/login.js
CHANGED
|
@@ -3,56 +3,55 @@ import pc from "picocolors";
|
|
|
3
3
|
import { setAuth, getApiUrl } from "../core/config.js";
|
|
4
4
|
import { api } from "../core/client.js";
|
|
5
5
|
function askQuestion(query, hideInput = false) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
if (!hideInput) {
|
|
7
|
+
const rl = readline.createInterface({
|
|
8
|
+
input: process.stdin,
|
|
9
|
+
output: process.stdout
|
|
10
|
+
});
|
|
11
|
+
return new Promise((resolve) => {
|
|
12
12
|
rl.question(query, (answer) => {
|
|
13
13
|
rl.close();
|
|
14
14
|
resolve(answer.trim());
|
|
15
15
|
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
stdin.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
resolve(input.trim());
|
|
34
|
-
break;
|
|
35
|
-
case "\u0003": // Ctrl+C
|
|
36
|
-
process.exit(1);
|
|
37
|
-
break;
|
|
38
|
-
case "\u007f": // Backspace
|
|
39
|
-
case "\b":
|
|
40
|
-
if (input.length > 0) {
|
|
41
|
-
input = input.slice(0, -1);
|
|
42
|
-
process.stdout.write("\b \b");
|
|
43
|
-
}
|
|
44
|
-
break;
|
|
45
|
-
default:
|
|
46
|
-
input += c;
|
|
47
|
-
process.stdout.write("*");
|
|
48
|
-
break;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return new Promise((resolve) => {
|
|
19
|
+
process.stdout.write(query);
|
|
20
|
+
const stdin = process.stdin;
|
|
21
|
+
let input = "";
|
|
22
|
+
const onData = (buf) => {
|
|
23
|
+
const str = buf.toString("utf-8");
|
|
24
|
+
for (const c of str) {
|
|
25
|
+
if (c === "\n" || c === "\r" || c === "\u0004") {
|
|
26
|
+
stdin.removeListener("data", onData);
|
|
27
|
+
if (stdin.isTTY)
|
|
28
|
+
stdin.setRawMode(false);
|
|
29
|
+
stdin.pause();
|
|
30
|
+
process.stdout.write("\n");
|
|
31
|
+
resolve(input.trim());
|
|
32
|
+
return;
|
|
49
33
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
34
|
+
else if (c === "\u0003") {
|
|
35
|
+
if (stdin.isTTY)
|
|
36
|
+
stdin.setRawMode(false);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
else if (c === "\u007f" || c === "\b") {
|
|
40
|
+
if (input.length > 0) {
|
|
41
|
+
input = input.slice(0, -1);
|
|
42
|
+
process.stdout.write("\b \b");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else if (c >= " ") {
|
|
46
|
+
input += c;
|
|
47
|
+
process.stdout.write("*");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
if (stdin.isTTY)
|
|
52
|
+
stdin.setRawMode(true);
|
|
53
|
+
stdin.resume();
|
|
54
|
+
stdin.on("data", onData);
|
|
56
55
|
});
|
|
57
56
|
}
|
|
58
57
|
export async function loginCommand(explicitToken) {
|