1 | #!/usr/bin/env node
|
2 |
|
3 | require('lazy-ass');
|
4 | var check = require('check-more-types');
|
5 |
|
6 | var log = console.log.bind(console);
|
7 | var debug = require('debug')('main');
|
8 | var _ = require('lodash');
|
9 | var pkg = require('../package.json');
|
10 | var updateNotifier = require('update-notifier');
|
11 | updateNotifier({ pkg: pkg }).notify();
|
12 |
|
13 | var options = {
|
14 | name: process.argv[2],
|
15 | from: process.argv[3],
|
16 | to: process.argv[4]
|
17 | };
|
18 |
|
19 | options.auth = _.some(process.argv, function (word) {
|
20 | return word === '--auth';
|
21 | });
|
22 | debug('options', options);
|
23 |
|
24 | var isValidCliOptions = check.schema.bind(null, {
|
25 | name: check.unemptyString,
|
26 | from: check.unemptyString,
|
27 | to: check.unemptyString
|
28 | });
|
29 | if (!isValidCliOptions(options)) {
|
30 | log('%s@%s <package name> <from version> <to version> [options]',
|
31 | pkg.name, pkg.version);
|
32 | log('options:\n --auth - login with github credentials for increased rate limit');
|
33 | process.exit(-1);
|
34 | }
|
35 |
|
36 | var changedLog = require('../src/changed-log');
|
37 | changedLog(options);
|