mirror of
https://github.com/markedjs/marked
synced 2024-11-23 09:48:17 +00:00
usage, fix input arg
This commit is contained in:
parent
37afe53bb3
commit
00a9c784f3
22
bin/marked
22
bin/marked
@ -1,20 +1,25 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Marked
|
||||
* CLI
|
||||
* Marked CLI
|
||||
* Copyright (c) 2011, Christopher Jeffrey (MIT License)
|
||||
*/
|
||||
|
||||
var fs = require('fs')
|
||||
, marked = require('../');
|
||||
|
||||
var usage = function() {
|
||||
console.log('');
|
||||
console.log('Usage:');
|
||||
console.log(' marked [-oih] [output] [input]');
|
||||
console.log('');
|
||||
console.log('');
|
||||
console.log('');
|
||||
console.log('');
|
||||
console.log('');
|
||||
console.log('Options:');
|
||||
console.log(' -o, --output: Specify output file. If none is');
|
||||
console.log(' specified, write to stdout.');
|
||||
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('');
|
||||
process.exit(0);
|
||||
};
|
||||
@ -26,7 +31,7 @@ var main = function(argv) {
|
||||
, arg
|
||||
, data;
|
||||
|
||||
var getarg = function(a) {
|
||||
var getarg = function() {
|
||||
var arg = argv.shift();
|
||||
arg = arg.split('=');
|
||||
if (/^['"]/.test(arg[0])) arg[0] = arg[0].slice(1, -1);
|
||||
@ -48,7 +53,8 @@ var main = function(argv) {
|
||||
break;
|
||||
case '-i':
|
||||
case '--input':
|
||||
input = arg;
|
||||
//input = argv.shift();
|
||||
input = getarg();
|
||||
break;
|
||||
case '--gfm':
|
||||
console.log('Implement me!');
|
||||
|
Loading…
Reference in New Issue
Block a user