Skip to content

Commit 2b09de1

Browse files
committed
refactor: simplify cli
1 parent fcc28dd commit 2b09de1

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ export function add(a: number, b: number) {
3838
}
3939
````
4040

41-
Now invoke `automd update`:
41+
Now invoke `automd`:
4242

4343
```sh
44-
npx automd@latest update
44+
npx automd@latest
4545
```
4646

4747
The declared section will be automatically updated:

src/cli.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
import { defineCommand, runMain } from "citty";
44
import consola from "consola";
5+
import { name, description, version } from "../package.json";
56
import { automd } from "./automd";
67

7-
const update = defineCommand({
8+
const main = defineCommand({
89
meta: {
9-
name: "update",
10+
name,
11+
description,
12+
version,
1013
},
1114
args: {
1215
dir: {
@@ -31,14 +34,4 @@ const update = defineCommand({
3134
},
3235
});
3336

34-
const main = defineCommand({
35-
meta: {
36-
name: "automd",
37-
description: "automatically maintain markdown contents",
38-
},
39-
subCommands: {
40-
update,
41-
},
42-
});
43-
4437
runMain(main);

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"esModuleInterop": true,
77
"strict": true,
88
"skipLibCheck": true,
9+
"resolveJsonModule": true
910
},
10-
"include": ["src"],
11+
"include": ["src"]
1112
}

0 commit comments

Comments
 (0)