Skip to content

Commit

Permalink
feat: add experimental CLI (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
uki00a authored May 16, 2023
1 parent 3035b13 commit b481e95
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
21 changes: 21 additions & 0 deletions cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { parse } from "./cli_deps.ts";
import { notify } from "./mod.ts";

async function main(args: Array<string>) {
const parsed = parse(args, {
string: ["title"],
});
const message = parsed._.join(" ");
const title = parsed.title || message;
await notify({
message,
title,
});
}

if (import.meta.main) {
main(Deno.args).catch((error) => {
console.error(error);
Deno.exit(1);
});
}
1 change: 1 addition & 0 deletions cli_deps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { parse } from "https://deno.land/[email protected]/flags/mod.ts";
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"tasks": {
"lint": "deno fmt --check && deno lint",
"typecheck": "deno check mod.ts",
"typecheck": "deno check mod.ts cli.ts",
"test": "deno test --allow-read --allow-run --allow-env=HOME --doc --import-map=import_map.test.json --coverage=coverage",
"coverage": "deno coverage ./coverage --lcov --output=coverage/lcov.info"
}
Expand Down

0 comments on commit b481e95

Please sign in to comment.