Skip to content

Commit

Permalink
Use rw instead of concat-stream, modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Jun 19, 2014
1 parent 76455ef commit acb92de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
"istanbul": "~0.2.11"
},
"dependencies": {
"minimist": "0.0.5",
"concat-stream": "~1.0.1",
"sharkdown": "0.0.1",
"strxml": "0.0.0"
"minimist": "0.1.0",
"strxml": "0.0.0",
"rw": "0.0.4"
}
}
16 changes: 5 additions & 11 deletions tokml
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
#!/usr/bin/env node

var tokml = require('./'),
sharkdown = require('sharkdown'),
concat = require('concat-stream'),
fs = require('fs'),
rw = require('rw'),
argv = require('minimist')(process.argv.slice(2), {
boolean: 'simplestyle'
}),
simplestyle = !!argv.simplestyle;
});

if (process.stdin.isTTY && !argv._[0]) {
process.stdout.write(sharkdown(fs.readFileSync(__dirname + '/HELP.md')));
process.stdout.write(rw.readSync(__dirname + '/HELP.md'));
process.exit(1);
}

(argv._.length ? fs.createReadStream(argv._[0]) : process.stdin).pipe(concat(convert));

function convert(data) {
process.stdout.write(tokml(JSON.parse(data), argv));
}
var input = rw.readSync(argv._.length ? argv._[0] : '/dev/stdin', 'utf8');
process.stdout.write(tokml(JSON.parse(input), argv));

0 comments on commit acb92de

Please sign in to comment.