forked from github-tools/github-release-notes
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgren-examples.js
More file actions
46 lines (39 loc) · 1.14 KB
/
Copy pathgren-examples.js
File metadata and controls
46 lines (39 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env node
import { Command } from "commander";
import chalk from "chalk";
import examples from "./_examples";
const gren = new Command();
let command;
const commandList = Object.keys(examples).filter(
(example) => example !== "default" && example !== "generateExamples",
);
gren
.name("gren examples")
.description(
`See few examples for how to use gren. For more informations (and a bit of UI) check ${chalk.blue(
"https://github-tools.github.io/github-release-notes/examples.html",
)}`,
)
.usage("<command>")
.on("--help", () => {
console.log("");
console.log(" Commands:");
console.log("");
console.log(" $ gren examples gren");
console.log(" $ gren examples release");
console.log(" $ gren examples changelog");
console.log("");
})
.action((cmd) => {
command = cmd;
})
.parse(process.argv);
if (!command || !commandList.includes(command)) {
console.error(
`${chalk.red("You must specify one of these commands to output examples")} [${commandList.join(
"|",
)}]`,
);
process.exit(1);
}
examples.generateExamples(command, examples[command]);