Skip to content

Commit da75527

Browse files
committed
add in a basic help menu
1 parent dbd5767 commit da75527

File tree

2 files changed

+32
-16
lines changed

2 files changed

+32
-16
lines changed

adr/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ If you need to regenerate this readme without creating a new ADR, please use `ad
1212
- [00001-Support-an-assets-folder](./00001-Support-an-assets-folder.md)
1313
- [00000-Use-Deno](./00000-Use-Deno.md)
1414

15-
Last generated 2024-11-20T23:37:05.656Z
15+
Last generated 2024-11-20T23:42:49.451Z

main.ts

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,38 @@ Last generated ${new Date().toISOString()}
8585

8686
// Learn more at https://docs.deno.com/runtime/manual/examples/module_metadata#concepts
8787
if (import.meta.main) {
88-
let adrdir = Deno.cwd();
89-
if (!adrdir.endsWith("adr")) {
90-
// we need to add the adr folder
91-
adrdir = path.join(adrdir, "adr");
92-
}
93-
94-
const files = await getAllFilesInDir(adrdir);
95-
await ensureAssetsDirExists(adrdir);
96-
const adrsOnly = files.filter((f) => /^\d{5}-.*$/.test(f.name));
9788
const action = Deno.args[0];
89+
if (action === "help" || (action !== "create" && action !== "regen")) {
90+
console.log(`adl
91+
Manage your Architecture Reference Diagrams with ease.
9892
99-
if (action == "create") {
100-
const name = Deno.args.slice(1).join(" ");
101-
const newFile = await makeNewADR(adrdir, adrsOnly.length, name);
102-
files.push(newFile);
103-
}
93+
help menu
10494
105-
await rebuildReadme(adrdir, files);
95+
supported arguments
96+
97+
create - adl create my-new-adr-name
98+
create a new ADR
99+
100+
regen - adl regen
101+
regenerate the ADR README
102+
`);
103+
} else {
104+
let adrdir = Deno.cwd();
105+
if (!adrdir.endsWith("adr")) {
106+
// we need to add the adr folder
107+
adrdir = path.join(adrdir, "adr");
108+
}
109+
110+
const files = await getAllFilesInDir(adrdir);
111+
await ensureAssetsDirExists(adrdir);
112+
const adrsOnly = files.filter((f) => /^\d{5}-.*$/.test(f.name));
113+
114+
if (action == "create") {
115+
const name = Deno.args.slice(1).join(" ");
116+
const newFile = await makeNewADR(adrdir, adrsOnly.length, name);
117+
files.push(newFile);
118+
}
119+
120+
await rebuildReadme(adrdir, files);
121+
}
106122
}

0 commit comments

Comments
 (0)