easc 0.0.26 → 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/package.json +1 -1
- package/src/utils/cli.ts +9 -11
package/package.json
CHANGED
package/src/utils/cli.ts
CHANGED
|
@@ -2,14 +2,6 @@ import yargs, { type Argv, type CommandModule, type Options } from "yargs";
|
|
|
2
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,8 +121,7 @@ class InteractiveCLI {
|
|
|
122
121
|
name: `${cmd.command.padEnd(12)} ${cmd.describe}`,
|
|
123
122
|
value: cmd.command,
|
|
124
123
|
})),
|
|
125
|
-
|
|
126
|
-
{ name: "Exit", value: "exit" },
|
|
124
|
+
{ name: "exit", value: "exit" },
|
|
127
125
|
],
|
|
128
126
|
});
|
|
129
127
|
|
|
@@ -195,7 +193,7 @@ class InteractiveCLI {
|
|
|
195
193
|
choices: [
|
|
196
194
|
...opt.choices.map((c: string) => ({ name: c, value: c })),
|
|
197
195
|
new Separator(),
|
|
198
|
-
{ name: "←
|
|
196
|
+
{ name: "← back", value: "__back__" },
|
|
199
197
|
],
|
|
200
198
|
});
|
|
201
199
|
|