heroku-cli-command
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -10,2 +10,10 @@ 'use strict' | ||
function epipe (fn) { | ||
try { | ||
fn() | ||
} catch (err) { | ||
if (err !== 'EPIPE') throw err | ||
} | ||
} | ||
function wrap (msg) { | ||
@@ -126,7 +134,9 @@ return linewrap(6, | ||
log (data, ...args) { | ||
this.action.pause(() => { | ||
if (this[stdout]) this[stdout].push(util.format(data, ...args)) | ||
else if (this[slack]) this[slack].push(util.format(data, ...args)) | ||
else if (arguments.length === 0) console.log() | ||
else console.log(data, ...args) | ||
epipe(() => { | ||
this.action.pause(() => { | ||
if (this[stdout]) this[stdout].push(util.format(data, ...args)) | ||
else if (this[slack]) this[slack].push(util.format(data, ...args)) | ||
else if (arguments.length === 0) console.log() | ||
else console.log(data, ...args) | ||
}) | ||
}) | ||
@@ -136,9 +146,13 @@ } | ||
write (msg) { | ||
if (this[slack]) this[slack].push(msg) | ||
else process.stdout.write(msg) | ||
epipe(() => { | ||
if (this[slack]) this[slack].push(msg) | ||
else process.stdout.write(msg) | ||
}) | ||
} | ||
writeError (msg) { | ||
if (this[slack]) this[slack].push(msg) | ||
else process.stderr.write(msg) | ||
epipe(() => { | ||
if (this[slack]) this[slack].push(msg) | ||
else process.stderr.write(msg) | ||
}) | ||
} | ||
@@ -201,19 +215,23 @@ | ||
error (err) { | ||
if (typeof err === 'string') { | ||
this.action.pause(() => { | ||
if (this[stderr]) this[stderr].push(err) | ||
else if (this[slack]) this[slack].push(err) | ||
else console.error(err) | ||
}) | ||
} else { | ||
if (this.action.spinner) this.action.done(this.color.bold.red('!')) | ||
if (this.debugging) console.error(err.stack) | ||
else console.error(bangify(wrap(getErrorMessage(err)), this.color.red(arrow))) | ||
} | ||
epipe(() => { | ||
if (typeof err === 'string') { | ||
this.action.pause(() => { | ||
if (this[stderr]) this[stderr].push(err) | ||
else if (this[slack]) this[slack].push(err) | ||
else console.error(err) | ||
}) | ||
} else { | ||
if (this.action.spinner) this.action.done(this.color.bold.red('!')) | ||
if (this.debugging) console.error(err.stack) | ||
else console.error(bangify(wrap(getErrorMessage(err)), this.color.red(arrow))) | ||
} | ||
}) | ||
} | ||
warn (message) { | ||
this.action.pause(() => { | ||
if (this.debugging) console.trace(`WARNING: ${message}`) | ||
else console.error(bangify(wrap(message), this.color.yellow(arrow))) | ||
epipe(() => { | ||
this.action.pause(() => { | ||
if (this.debugging) console.trace(`WARNING: ${message}`) | ||
else console.error(bangify(wrap(message), this.color.yellow(arrow))) | ||
}) | ||
}) | ||
@@ -224,5 +242,5 @@ } | ||
const ansi = require('ansi-escapes') | ||
process.stderr.write(ansi.cursorShow) | ||
if (process.stderr.isTTY) process.stderr.write(ansi.cursorShow) | ||
} | ||
} | ||
} |
{ | ||
"name": "heroku-cli-command", | ||
"description": "base Heroku CLI command", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": "Jeff Dickey @dickeyxxx", | ||
@@ -6,0 +6,0 @@ "bugs": "https://github.com/heroku/heroku-cli-command/issues", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
153478
2194