UNPKG

1.29 kBPlain TextView Raw
1#!/usr/bin/env node
2'use strict';
3
4var pkg = require('../package.json');
5var commands = require('../lib/commands.js');
6
7var program = require('commander');
8var prompt = require('prompt');
9
10function callback(err, success){
11 if (err) {
12 return console.log('ERROR: '+err);
13 } else if (success) {
14 console.log(success);
15 }
16}
17
18program.version(pkg.version);
19
20program
21 .command('init')
22 .description('Create the CHANGELOG.md in the current directory')
23 .action(function(args){
24 commands.init({}, callback);
25 });
26
27program
28 .command('add [line]')
29 .description('Add one line to the changelog')
30 .action(function(line, info){
31 commands.add(line, {}, callback);
32 });
33
34program
35 .command('release [version]')
36 .description('Move unreleased changes under a new release heading')
37 .option('-d, --date [date]', 'Specify a date (defaults to today)')
38 .action(function(version, info){
39 var options = {};
40
41 if (info.date) {
42 options.date = info.date;
43 }
44
45 commands.release(version, options, callback);
46 });
47
48program
49 .command('delete')
50 .description('Delete the changelog')
51 .action(function(info){
52 commands.delete({}, callback);
53 });
54
55program.parse(process.argv);
56
57// default to help if no commands
58if (program.args.length === 0) {
59 program.help();
60}
\No newline at end of file