easc 0.0.25 → 0.0.27
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.ts +1 -1
- package/package.json +1 -1
- package/src/utils/cli.ts +11 -11
package/index.ts
CHANGED
|
@@ -8,9 +8,9 @@ import { update } from "./src/commands/update";
|
|
|
8
8
|
cli(hideBin(process.argv))
|
|
9
9
|
.scriptName("easc")
|
|
10
10
|
.usage("$0 <command> [options]")
|
|
11
|
+
.command(update)
|
|
11
12
|
.command(build)
|
|
12
13
|
.command(buildRun)
|
|
13
|
-
.command(update)
|
|
14
14
|
.demandCommand(1, "")
|
|
15
15
|
.help()
|
|
16
16
|
.alias("help", "h")
|
package/package.json
CHANGED
package/src/utils/cli.ts
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import yargs, { type Argv, type CommandModule, type Options } from "yargs";
|
|
2
|
-
import { select } from "@inquirer/prompts";
|
|
2
|
+
import { select, Separator } from "@inquirer/prompts";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
|
|
5
|
-
// Custom error to signal going back to menu
|
|
6
|
-
class BackToMenuError extends Error {
|
|
7
|
-
constructor() {
|
|
8
|
-
super("Back to menu");
|
|
9
|
-
this.name = "BackToMenuError";
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
5
|
interface CommandInfo {
|
|
14
6
|
command: string;
|
|
15
7
|
describe: string;
|
|
@@ -17,6 +9,13 @@ interface CommandInfo {
|
|
|
17
9
|
handler: (argv: any) => void | Promise<void>;
|
|
18
10
|
}
|
|
19
11
|
|
|
12
|
+
class BackToMenuError extends Error {
|
|
13
|
+
constructor() {
|
|
14
|
+
super("Back to menu");
|
|
15
|
+
this.name = "BackToMenuError";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
20
19
|
class InteractiveCLI {
|
|
21
20
|
private args: string[];
|
|
22
21
|
private commands: CommandInfo[] = [];
|
|
@@ -122,7 +121,7 @@ class InteractiveCLI {
|
|
|
122
121
|
name: `${cmd.command.padEnd(12)} ${cmd.describe}`,
|
|
123
122
|
value: cmd.command,
|
|
124
123
|
})),
|
|
125
|
-
{ name: "
|
|
124
|
+
{ name: "exit", value: "exit" },
|
|
126
125
|
],
|
|
127
126
|
});
|
|
128
127
|
|
|
@@ -193,7 +192,8 @@ class InteractiveCLI {
|
|
|
193
192
|
message: `Select ${key.replace(/-/g, " ")}:`,
|
|
194
193
|
choices: [
|
|
195
194
|
...opt.choices.map((c: string) => ({ name: c, value: c })),
|
|
196
|
-
|
|
195
|
+
new Separator(),
|
|
196
|
+
{ name: "← back", value: "__back__" },
|
|
197
197
|
],
|
|
198
198
|
});
|
|
199
199
|
|