usage, fix input arg

This commit is contained in:
Christopher Jeffrey 2011-10-14 16:54:08 -05:00
parent 37afe53bb3
commit 00a9c784f3

View File

@ -1,20 +1,25 @@
#!/usr/bin/env node #!/usr/bin/env node
/** /**
* Marked * Marked CLI
* CLI * Copyright (c) 2011, Christopher Jeffrey (MIT License)
*/ */
var fs = require('fs') var fs = require('fs')
, marked = require('../'); , marked = require('../');
var usage = function() { var usage = function() {
console.log('');
console.log('Usage:'); console.log('Usage:');
console.log(' marked [-oih] [output] [input]');
console.log(''); console.log('');
console.log(''); console.log('Options:');
console.log(''); console.log(' -o, --output: Specify output file. If none is');
console.log(''); console.log(' specified, write to stdout.');
console.log(''); console.log(' -i, --input: Specify input file, otherwise use last');
console.log(' argument as input file. If no input');
console.log(' file is specified, read from stdin.');
console.log(' -h, --help: Display this message.');
console.log(''); console.log('');
process.exit(0); process.exit(0);
}; };
@ -26,7 +31,7 @@ var main = function(argv) {
, arg , arg
, data; , data;
var getarg = function(a) { var getarg = function() {
var arg = argv.shift(); var arg = argv.shift();
arg = arg.split('='); arg = arg.split('=');
if (/^['"]/.test(arg[0])) arg[0] = arg[0].slice(1, -1); if (/^['"]/.test(arg[0])) arg[0] = arg[0].slice(1, -1);
@ -48,7 +53,8 @@ var main = function(argv) {
break; break;
case '-i': case '-i':
case '--input': case '--input':
input = arg; //input = argv.shift();
input = getarg();
break; break;
case '--gfm': case '--gfm':
console.log('Implement me!'); console.log('Implement me!');