forked from ariatemplates/git-release-notes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
executable file
·65 lines (64 loc) · 1.63 KB
/
cli.js
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env node
var argv = require('yargs')
.usage('git-release-notes [<options>] <since>..<until> <template>')
.demandCommand(2)
.example(
'git-release-notes -t "(feat|bug): (.*)" -m type -m title v1.0.0..v2.0.0 markdown',
'Match all commits with starting with either `feat:` or `bug` between the tags `v1.0.0` and `v2.0.0`'
)
.wrap(null)
.option('f', {
alias: 'file',
describe: 'Configuration file. Use it instead of passing command line options'
})
.option('p', {
alias: 'path',
describe: 'Git project path. Defaults to the current path',
default: process.cwd(),
})
.option('t', {
alias: 'title',
describe: 'Commit title regular expression',
default: '(.*)',
})
.option('i', {
alias: 'ignore-case',
describe: 'Ignore case of title\'s regular expression',
type: 'boolean',
})
.option('m', {
alias: 'meaning',
describe: 'Meaning of capturing block in title\'s regular expression',
default: ['type'],
})
.option('b', {
alias: 'branch',
describe: 'Git branch, defaults to master',
default: 'master',
type: 'string',
})
.option('s', {
alias: 'script',
describe: 'External script to rewrite the commit history',
})
.option('o', {
alias: 'gitlog-option',
describe: 'Additional git log options AND ignore \'c\' option',
default: [],
})
.option('c', {
alias: 'merge-commits',
describe: 'Only use merge commits',
type: 'boolean',
})
.argv;
const index = require('./index');
index(argv, argv._[0], argv._[1])
.then(function (output) {
process.stdout.write(output + "\n");
})
.catch(function (error) {
require('yargs').showHelp();
console.error('\n', error.message);
process.exit(1);
});