txt and print output support (cli)

This commit is contained in:
gauthiier 2014-08-20 14:54:49 +02:00
parent 7478a5b305
commit ceeede4ea5
2 changed files with 14 additions and 2 deletions

View File

@ -92,7 +92,7 @@ for (var i = 0; i < process.argv.length; i++) {
case "--output":
var o = process.argv[++i];
if(o == 'html' || o == 'md') conf.output = o;
if(o == 'html' || o == 'md' || o == 'txt') conf.output = o;
break;
case "--style":

View File

@ -59,6 +59,7 @@
var data_file = "";
var index = false;
var print = false;
for (var i = 0; i < process.argv.length; i++) {
switch(process.argv[i])
@ -69,6 +70,11 @@ for (var i = 0; i < process.argv.length; i++) {
case "--index":
index = true;
break;
case "--print":
print = true;
break;
default:
break;
}
}
@ -103,7 +109,13 @@ for (var i = 0; i < alldata.length; i++) {
if(index) {
items.sort();
if(print) {
_.each(items, function (i) {
console.log('> ' + i);
});
} else {
console.log(JSON.stringify(items, null, 2));
}
}
if(!index)