Skip to content

Commit

Permalink
add cli
Browse files Browse the repository at this point in the history
  • Loading branch information
ungoldman committed Mar 8, 2015
1 parent c5d07f7 commit 8a8bcb4
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 6 deletions.
17 changes: 13 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# changelog-parser changelog
# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
This change log adheres to standards from [Keep a CHANGELOG](http://keepachangelog.com).

## Unreleased
## [1.1.0] - 2015-03-07
* add cli support
* remove `description` key if empty
* add contributing info
* add node 0.10 to travis-ci testing environments

## 1.0.1
## [1.0.1] - 2015-03-02
* fix readme example for @[paulcpederson](github.com/paulcpederson/)

## 1.0.0
## 1.0.0 - 2015-03-02
* init

[1.1.0]: https://github.com/ngoldman/magnet-link/compare/v1.0.1...v1.1.0
[1.0.1]: https://github.com/ngoldman/magnet-link/compare/v1.0.0...v1.0.1
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@ parseChangelog('path/to/CHANGELOG.md', function (err, result) {
})
```

## Command-line interface

There is also a command-line interface available if you install it with `-g`.

```
npm install -g changelog-parser
```

This installs a program called `changelog-parser` that you simply pass a `CHANGELOG.md` file.

```
changelog-parser path/to/CHANGELOG.md
```

This will print the JSON object representing the change log to the terminal.

Alternately you can run it without arguments and it will look for a `CHANGELOG.md` file in the working directory.

## Standards

This module assumes your changelog is:
Expand Down
20 changes: 20 additions & 0 deletions bin/cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

var parseChangelog = require('..')
var path = require('path')
var file = process.argv[2] || 'CHANGELOG.md'
var help = process.argv[2] === '-h' || process.argv[2] === '--help'

if (help) {
console.log('usage: changelog-parser [filename]')
process.exit(0)
}

parseChangelog(file, function (err, result) {
if (err) {
console.error(err)
process.exit(1)
}

console.log(result)
})
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"name": "changelog-parser",
"description": "Change log parser for node.",
"version": "1.0.1",
"version": "1.1.0",
"author": "Nate Goldman <[email protected]>",
"bin": {
"changelog-parser": "./bin/cli.js"
},
"bugs": {
"url": "https://github.com/ngoldman/changelog-parser/issues"
},
Expand All @@ -19,7 +22,8 @@
},
"homepage": "https://github.com/ngoldman/changelog-parser",
"keywords": [
"changelog"
"changelog",
"CHANGELOG.md"
],
"license": "ISC",
"main": "index.js",
Expand Down

0 comments on commit 8a8bcb4

Please sign in to comment.