forked from github-tools/github-release-notes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgren-examples.js
More file actions
34 lines (28 loc) · 1.1 KB
/
gren-examples.js
File metadata and controls
34 lines (28 loc) · 1.1 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
#!/usr/bin/env node
import gren from 'commander';
import chalk from 'chalk';
import examples from './_examples';
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]);