build-changelog
Advanced tools
Comparing version 1.4.2 to 1.5.0
@@ -7,2 +7,3 @@ #!/usr/bin/env node | ||
var fs = require('fs'); | ||
var template = require('string-template'); | ||
@@ -13,5 +14,12 @@ var installModule = require('./install.js'); | ||
function printHelp() { | ||
function printHelp(opts) { | ||
opts = opts || {}; | ||
var loc = path.join(__dirname, 'usage.md'); | ||
var content = fs.readFileSync(loc, 'utf8'); | ||
content = template(content, { | ||
cmd: opts.cmd || 'build-changelog' | ||
}); | ||
return console.log(msee.parse(content, { | ||
@@ -23,8 +31,8 @@ paragraphStart: '\n' | ||
function main(opts) { | ||
if (opts.h || opts.help) { | ||
return printHelp(); | ||
var command = opts._[0]; | ||
if (opts.h || opts.help || command === 'help') { | ||
return printHelp(opts); | ||
} | ||
var command = opts._[0]; | ||
if (!opts.folder) { | ||
@@ -31,0 +39,0 @@ opts.folder = process.cwd(); |
@@ -1,2 +0,2 @@ | ||
# build-changelog [options] | ||
# {cmd} [options] | ||
@@ -17,7 +17,7 @@ Builds the CHANGELOG file and commits it to git. Either creates | ||
## `build-changelog --help` | ||
## `{cmd} --help` | ||
Prints this message | ||
## `build-changelog install` | ||
## `{cmd} install` | ||
@@ -29,3 +29,3 @@ Will write a `changelog` script to your `package.json` file. | ||
"scripts": { | ||
"changelog": "build-changelog" | ||
"changelog": "{cmd}" | ||
} | ||
@@ -38,6 +38,6 @@ } | ||
## `build-changelog version [<newversion> | major | minor | patch]` | ||
## `{cmd} version [<newversion> | major | minor | patch]` | ||
This is the same as `build-changelog` except allows you to set | ||
a specific version. `build-changelog` will by default bump | ||
This is the same as `{cmd}` except allows you to set | ||
a specific version. `{cmd}` will by default bump | ||
the minor version number. | ||
@@ -48,4 +48,4 @@ | ||
## `build-changelog read <file>` | ||
## `{cmd} read <file>` | ||
Reads and parses a changelog file and writes JSON to stdout |
{ | ||
"name": "build-changelog", | ||
"version": "1.4.2", | ||
"version": "1.5.0", | ||
"description": "A CLI to auto-generate a deploy ready changelog", | ||
@@ -22,3 +22,4 @@ "keywords": [], | ||
"minimist": "0.0.8", | ||
"msee": "^0.1.1" | ||
"msee": "^0.1.1", | ||
"string-template": "~0.1.3" | ||
}, | ||
@@ -47,2 +48,2 @@ "devDependencies": { | ||
} | ||
} | ||
} |
39076
684
9
+ Addedstring-template@~0.1.3
+ Addedstring-template@0.1.3(transitive)