Browse Source

make options available on cli

dev/fix.absolute.path
Brett Langdon 12 years ago
parent
commit
88449d697b
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      bin/jsnice

+ 10
- 1
bin/jsnice View File

@ -8,11 +8,15 @@ var jsnice = require('../');
var doc = [
'Usage:',
' jsnice <file>',
' jsnice [--no-pretty] [--no-rename] [--no-types] <file>',
' jsnice (--help | --version)',
'',
'Options:',
' --help Show this text',
' --version Show jsnice version info',
' --no-pretty Dont prettify the script',
' --no-rename Dont rename variables',
' --no-types Dont add doc strings for params/returns',
].join('\r\n');
var args = docopt.docopt(doc, {
@ -23,7 +27,12 @@ var cwd = process.cwd();
filePath = path.join(cwd, args['<file>']);
var js = fs.readFileSync(filePath);
jsnice.nicify(js, function(err, data) {
var options = {
pretty: !args['--no-pretty'],
types: !args['--no-types'],
rename: !args['--no-rename'],
};
jsnice.nicify(js, options, function(err, data) {
if (err) {
console.error(err);
process.exit(1);


Loading…
Cancel
Save