diff --git a/lib/cli.js b/lib/cli.js index 63b7ade..64156f3 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -2,11 +2,23 @@ var fs = require('fs') var semicolonIndent = require('../') -var pkg = require('../package.json') + +var help = function () { + /* + Usage: + semicolon-indent -- + + 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()) {