From 7765e853367b737bc077ae1390f93e5dc6ce9520 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Thu, 14 Jan 2016 09:46:29 -0500 Subject: [PATCH] Integrate printf(). --- package.json | 1 + src/cli/error-handler.js | 2 +- src/cli/main.js | 1 + src/cli/out.js | 4 +++- test/test-stdout.js | 4 ++-- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 096aeb1..ce2b385 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "moment": "^2.10.6", "parse-filepath": "^0.6.3", "path-exists": "^2.1.0", + "printf": "^0.2.3", "recursive-readdir-sync": "^1.0.6", "simple-html-tokenizer": "^0.2.0", "slash": "^1.0.0", diff --git a/src/cli/error-handler.js b/src/cli/error-handler.js index 7a865dc..5af601f 100644 --- a/src/cli/error-handler.js +++ b/src/cli/error-handler.js @@ -51,7 +51,7 @@ Error-handling routines for HackMyResume. } else { o( ex ); - var stackTrace = ex.stack || (ex.inner && ex.inner.stack) + var stackTrace = ex.stack || (ex.inner && ex.inner.stack); if( stackTrace && this.debug ) o( ex.stack || ex.inner.stack ); diff --git a/src/cli/main.js b/src/cli/main.js index c06ea3e..1c6fb40 100644 --- a/src/cli/main.js +++ b/src/cli/main.js @@ -210,6 +210,7 @@ Definition of the `main` function. } + /** Invoke a HackMyResume verb. */ diff --git a/src/cli/out.js b/src/cli/out.js index 2ef4198..06d604b 100644 --- a/src/cli/out.js +++ b/src/cli/out.js @@ -39,7 +39,9 @@ Output routines for HackMyResume. log: function( msg ) { msg = msg || ''; - this.opts.silent || console.log.apply( console.log, arguments ); + var printf = require('printf'); + var finished = printf.apply( printf, arguments ); + this.opts.silent || console.log( finished ); }, diff --git a/test/test-stdout.js b/test/test-stdout.js index 68af4f1..ff0a381 100644 --- a/test/test-stdout.js +++ b/test/test-stdout.js @@ -16,7 +16,7 @@ describe('Testing Ouput interface', function () { function MyConsoleLog( msg ) { - gather += msg; + gather += Array.prototype.slice.call(arguments).join(' '); ConsoleLogOrg.apply(this, arguments); } @@ -101,7 +101,7 @@ describe('Testing Ouput interface', function () { 'test/sandbox/temp/janeq-1.all', '-o', "{ theme: 'compact', debug: true, pdf: 'wkhtmltopdf' }"], - [ 'Applying COMPACT theme', '(with wkhtmltopdf)'] ); + [ 'Applying COMPACT theme (', '(with wkhtmltopdf)'] ); run('HMR should accept a JSON settings file via --options', [