Sha256: 8c10d3037d6ade023c2aae5e1da327a855314641e2d04f944531804ff6753639

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

#!/usr/bin/env node

/**
 * Module dependencies.
 */

var program = require('commander')
  , util = require('util')
  , dox = require('../');

// options

program
  .version(dox.version)
  .option('-r, --raw', 'output "raw" comments, leaving the markdown intact')
  .option('-d, --debug', 'output parsed comments for debugging');

// examples

program.on('--help', function(){
  console.log('  Examples:');
  console.log('');
  console.log('    # stdin');
  console.log('    $ dox > myfile.json');
  console.log('');
  console.log('    # operates over stdio');
  console.log('    $ dox < myfile.js > myfile.json');
  console.log('');
});

// parse argv

program.parse(process.argv);

// process stdin

var buf = '';
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk){ buf += chunk; });
process.stdin.on('end', function(){
  var obj = dox.parseComments(buf, { raw: program.raw });
  if (program.debug) {
    process.stdout.write(util.inspect(obj, false, Infinity, true) + '\n');
  } else {
    process.stdout.write(JSON.stringify(obj, null, 2));
  }
}).resume();

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spacedocs-0.0.3 lib/node_modules/dox/bin/dox
spacedocs-0.0.2 dox/bin/dox