Browse Source

Merge pull request #312 from mjbvz/add-output-option-to-client

Add Output Option to CLI
pull/149/merge
Vitaly Puzrin 8 years ago
committed by GitHub
parent
commit
db1038585f
  1. 10
      bin/markdown-it.js

10
bin/markdown-it.js

@ -42,6 +42,11 @@ cli.addArgument([ 'file' ], {
defaultValue: '-'
});
cli.addArgument([ '-o', '--output' ], {
help: 'File to write',
defaultValue: '-'
});
var options = cli.parseArgs();
@ -99,5 +104,10 @@ readFile(options.file, 'utf8', function (err, input) {
process.exit(1);
}
if (options.output === '-') {
// write to stdout
process.stdout.write(output);
} else {
fs.writeFileSync(options.output, output);
}
});

Loading…
Cancel
Save