Skip to content

Commit

Permalink
feat(CLI): added help
Browse files Browse the repository at this point in the history
  • Loading branch information
christophwitzko committed Feb 2, 2015
1 parent 1d95818 commit dc8a81a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,23 @@

var fs = require('fs')
var semicolonIndent = require('../')
var pkg = require('../package.json')

var help = function () {
/*
Usage:
semicolon-indent <options> -- <file>
Options:
-f, --force Indent everything with semicolons
-v, --version Output the current version
-h, --help Output this help info
*/
}.toString().split(/\n/).slice(2, -2).join('\n')

module.exports = function (argv) {
process.stdin.setEncoding('utf8')
if (argv.version || argv.v) return console.log(pkg.version)
if (argv.version || argv.v) return console.log(require('../package.json').version)
if (argv.help || argv.h) return console.log(help)
var fmode = argv.force || argv.f
var inputFile = argv._.shift()
if (fs.existsSync(inputFile) && fs.statSync(inputFile).isFile()) {
Expand Down

0 comments on commit dc8a81a

Please sign in to comment.