Skip to content

Commit 68ee7d0

Browse files
authored
Merge pull request #26 from kinfuy/dev
fix: unknown options output help(#25)
2 parents 3ef54d3 + 3d4e6c4 commit 68ee7d0

File tree

8 files changed

+1112
-1014
lines changed

8 files changed

+1112
-1014
lines changed

dist/gacm.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const execCommand = async (cmd, args) => {
111111
};
112112

113113
var name$1 = "gacm";
114-
var version$1 = "1.2.10";
114+
var version$1 = "1.2.11";
115115
var description$1 = "gacm";
116116
var author$1 = "alqmc";
117117
var license$1 = "MIT";
@@ -205,7 +205,7 @@ const insertUser = async (name, email, alias = name) => {
205205
};
206206

207207
var name = "gacm";
208-
var version = "1.2.10";
208+
var version = "1.2.11";
209209
var description = "git account manage";
210210
var author = "kinfuy (https://github.com/kinfuy)";
211211
var license = "MIT";
@@ -364,4 +364,14 @@ program.command("add", "\u6DFB\u52A0\u7528\u6237").option("-n, --name <name>", "
364364
program.command("alias <origin> <target>", "\u6DFB\u52A0\u522B\u540D").action(useAlias);
365365
program.command("delete <name>", "\u5220\u9664\u7528\u6237").action(useDelete);
366366
program.help();
367-
program.parse(process.argv);
367+
const init = async () => {
368+
try {
369+
program.parse(process.argv, { run: false });
370+
await program.runMatchedCommand();
371+
} catch (error) {
372+
console.error(error?.message || "\u672A\u77E5\u9519\u8BEF");
373+
program.outputHelp();
374+
process.exit(0);
375+
}
376+
};
377+
init();

dist/gnrm.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var execa__default = /*#__PURE__*/_interopDefaultLegacy(execa);
1919
var fetch__default = /*#__PURE__*/_interopDefaultLegacy(fetch);
2020

2121
var name$1 = "gacm";
22-
var version$1 = "1.2.10";
22+
var version$1 = "1.2.11";
2323
var description$1 = "git account manage";
2424
var author$1 = "kinfuy (https://github.com/kinfuy)";
2525
var license$1 = "MIT";
@@ -187,7 +187,7 @@ const execCommand = async (cmd, args) => {
187187
};
188188

189189
var name = "gacm";
190-
var version = "1.2.10";
190+
var version = "1.2.11";
191191
var description = "gacm";
192192
var author = "alqmc";
193193
var license = "MIT";
@@ -551,4 +551,14 @@ program.command("add", "\u6DFB\u52A0\u955C\u50CF").option("-n, --name <name>", "
551551
program.command("alias <origin> <target>", "\u955C\u50CF\u6DFB\u52A0\u522B\u540D").action(useAlias);
552552
program.command("delete <name>", "\u5220\u9664\u955C\u50CF").action(useDelete);
553553
program.help();
554-
program.parse(process.argv);
554+
const init = async () => {
555+
try {
556+
program.parse(process.argv, { run: false });
557+
await program.runMatchedCommand();
558+
} catch (error) {
559+
console.error(error?.message || "\u672A\u77E5\u9519\u8BEF");
560+
program.outputHelp();
561+
process.exit(0);
562+
}
563+
};
564+
init();

dist/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gacm",
3-
"version": "1.2.10",
3+
"version": "1.2.11",
44
"private": false,
55
"description": "git account manage",
66
"author": "kinfuy (https://github.com/kinfuy)",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gacm",
3-
"version": "1.2.10",
3+
"version": "1.2.11",
44
"description": "gacm",
55
"author": "alqmc",
66
"license": "MIT",

package/gacm.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,16 @@ program.command('delete <name>', '删除用户').action(useDelete);
2828

2929
program.help();
3030

31-
program.parse(process.argv);
31+
const init = async () => {
32+
try {
33+
program.parse(process.argv, { run: false });
34+
await program.runMatchedCommand();
35+
}
36+
catch (error: any) {
37+
console.error(error?.message || '未知错误');
38+
program.outputHelp();
39+
process.exit(0);
40+
}
41+
};
42+
43+
init();

package/gnrm.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,16 @@ program.command('delete <name>', '删除镜像').action(useDelete);
3434

3535
program.help();
3636

37-
program.parse(process.argv);
37+
const init = async () => {
38+
try {
39+
program.parse(process.argv, { run: false });
40+
await program.runMatchedCommand();
41+
}
42+
catch (error: any) {
43+
console.error(error?.message || '未知错误');
44+
program.outputHelp();
45+
process.exit(0);
46+
}
47+
};
48+
49+
init();

package/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gacm",
3-
"version": "1.2.10",
3+
"version": "1.2.11",
44
"private": false,
55
"description": "git account manage",
66
"author": "kinfuy (https://github.com/kinfuy)",

0 commit comments

Comments
 (0)