Skip to content

Commit 2eee61c

Browse files
committed
chore: add comment
1 parent 7c9992f commit 2eee61c

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

packages/clerc/src/cli.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ export class Clerc<C extends CommandRecord = {}> {
234234
const { _: args, flags } = parsed;
235235
let parameters = this.#isSingleCommand || !isCommandResolved ? args : args.slice(command.name.split(" ").length);
236236
let commandParameters = command?.parameters || [];
237+
// eof handle
237238
const hasEof = commandParameters.indexOf("--");
238239
const eofParameters = commandParameters.slice(hasEof + 1) || [];
239240
const mapping: Record<string, string | string[]> = Object.create(null);
@@ -281,8 +282,8 @@ export class Clerc<C extends CommandRecord = {}> {
281282
this.#commandEmitter.emit(command.name, handlerContext);
282283
};
283284
const inspectors = [...this.#inspectors, emitHandler];
284-
const inspector = compose(inspectors);
285-
inspector(getContext);
285+
const callInspector = compose(inspectors);
286+
callInspector(getContext);
286287
return this;
287288
}
288289
}

test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Clerc, defineCommandWithHandler } from "./packages/clerc/src";
2+
import { helpPlugin } from "./packages/plugin-help/src";
3+
4+
const _cli = Clerc.create()
5+
.name("tsxt")
6+
.use(helpPlugin())
7+
.command("tmp as", "f", {
8+
alias: [
9+
"af",
10+
],
11+
flags: {
12+
ab: {
13+
description: "adf",
14+
type: Number,
15+
default: 123,
16+
},
17+
},
18+
parameters: [
19+
"<asfd>",
20+
],
21+
})
22+
.on("tmp as", (ctx) => {
23+
ctx.name;
24+
ctx.flags;
25+
// console.log(ctx);
26+
})
27+
// .command(CommandWithHandler)
28+
.parse();

0 commit comments

Comments
 (0)