diff --git a/bin/index.js b/bin/index.js index c3f7575..442975e 100755 --- a/bin/index.js +++ b/bin/index.js @@ -1,2 +1,10 @@ #!/usr/bin/env node -require('../').cli(process.argv.slice(2)); \ No newline at end of file +require('../') + .cli(process.argv.slice(2)) + .then( + function() {}, + function(e) { + console.error(e); + process.exit(1); + } + ); diff --git a/index.js b/index.js index ac5e122..fdf0e99 100755 --- a/index.js +++ b/index.js @@ -12,7 +12,7 @@ var renderImpl = require('./render'); module.exports.render = render; module.exports.cli = cli; -function cli(args) { +async function cli(args) { if (args.length === 1 && /.(js|json)$/i.test(args[0])) { render(path.resolve(process.cwd(), args.shift()), process); @@ -20,12 +20,11 @@ function cli(args) { } if (args.length > 1) { - render({ + return render({ input : [ args.shift() ], output : [ args ], cwd : process.cwd() }, process); - return; } if (!args.length || (args.length === 1 && /(-h|--help|help)$/i.test(args[0]))) {