Skip to content

Commit

Permalink
refactor: simplify cli
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Feb 5, 2024
1 parent fcc28dd commit 2b09de1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ export function add(a: number, b: number) {
}
````

Now invoke `automd update`:
Now invoke `automd`:

```sh
npx automd@latest update
npx automd@latest
```

The declared section will be automatically updated:
Expand Down
17 changes: 5 additions & 12 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

import { defineCommand, runMain } from "citty";
import consola from "consola";
import { name, description, version } from "../package.json";
import { automd } from "./automd";

const update = defineCommand({
const main = defineCommand({
meta: {
name: "update",
name,
description,
version,
},
args: {
dir: {
Expand All @@ -31,14 +34,4 @@ const update = defineCommand({
},
});

const main = defineCommand({
meta: {
name: "automd",
description: "automatically maintain markdown contents",
},
subCommands: {
update,
},
});

runMain(main);
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"resolveJsonModule": true
},
"include": ["src"],
"include": ["src"]
}

0 comments on commit 2b09de1

Please sign in to comment.