heroku-cli-util
Advanced tools
Comparing version 6.0.13 to 6.0.14
@@ -6,3 +6,3 @@ 'use strict' | ||
function ErrorExit (code) { | ||
function ErrorExit (code, message) { | ||
Error.call(this) | ||
@@ -13,2 +13,3 @@ Error.captureStackTrace(this, this.constructor) | ||
this.code = code | ||
this.message = message | ||
} | ||
@@ -25,3 +26,3 @@ | ||
if (mocking) { | ||
throw new ErrorExit(code) | ||
throw new ErrorExit(code, message) | ||
} else { | ||
@@ -28,0 +29,0 @@ process.exit(code) |
@@ -14,5 +14,2 @@ 'use strict' | ||
let input = '' | ||
if (!stdin.isTTY) { | ||
throw new Error(`Error: CLI needs to prompt for ${options.name || options.prompt} but stdin is not a tty.`) | ||
} | ||
stdin.setEncoding('utf8') | ||
@@ -87,3 +84,4 @@ stderr.write(ansi.eraseLine) | ||
options.prompt = name ? color.gray(`${name}: `) : color.gray('> ') | ||
if (options.mask || options.hide) return promptMasked(options) | ||
let isTTY = process.env.TERM !== 'dumb' && process.stdin.isTTY | ||
if (isTTY && (options.mask || options.hide)) return promptMasked(options) | ||
return new Promise(function (resolve) { | ||
@@ -90,0 +88,0 @@ process.stdin.setEncoding('utf8') |
@@ -25,3 +25,3 @@ 'use strict' | ||
this.stream = this.options.stream || process.stderr | ||
this.enabled = !console.mocking() && (this.stream && this.stream.isTTY) && !process.env.CI | ||
this.enabled = !console.mocking() && (this.stream && this.stream.isTTY) && !process.env.CI && process.env.TERM !== 'dumb' | ||
this.warnings = [] | ||
@@ -80,3 +80,3 @@ } | ||
if (!this._output) return | ||
this.stream.write(this.ansi.cursorUp(this._lines)) | ||
this.stream.write(this.ansi.cursorUp(this._lines(this._output))) | ||
this.stream.write(this.ansi.eraseDown) | ||
@@ -92,4 +92,4 @@ } | ||
get _lines () { | ||
return color.stripColor(this._output) | ||
_lines (s) { | ||
return color.stripColor(s) | ||
.split('\n') | ||
@@ -105,9 +105,9 @@ .map(l => Math.ceil(l.length / this._width)) | ||
_spin () { | ||
this.stream.write(this.ansi.cursorUp(this._lines)) | ||
let x = color.stripColor(this.text).length + 1 | ||
let y = Math.floor(x / this._width) | ||
x = x - y * this._width | ||
this.stream.write(this.ansi.cursorUp(this._lines(this._output))) | ||
let y = this._lines(this.text) - 1 | ||
let lastline = color.stripColor(this.text).split('\n').pop() | ||
let x = 1 + lastline.length - (this._lines(lastline) - 1) * this._width | ||
this.stream.write(this.ansi.cursorMove(x, y)) | ||
this.stream.write(this._frame()) | ||
this.stream.write(this.ansi.cursorDown(this._lines - y)) | ||
this.stream.write(this.ansi.cursorDown(this._lines(this._output) - y)) | ||
this.stream.write(this.ansi.cursorLeft) | ||
@@ -114,0 +114,0 @@ this.stream.write(this.ansi.eraseLine) |
{ | ||
"name": "heroku-cli-util", | ||
"description": "Set of helpful CLI utilities", | ||
"version": "6.0.13", | ||
"version": "6.0.14", | ||
"author": "Jeff Dickey (@dickeyxxx)", | ||
@@ -39,2 +39,3 @@ "bugs": { | ||
"mocha": "^2.2.4", | ||
"mocha-junit-reporter": "1.11.1", | ||
"nock": "8.0.0", | ||
@@ -47,2 +48,5 @@ "nyc": "6.4.4", | ||
}, | ||
"engines": { | ||
"node": ">= 6.0.0" | ||
}, | ||
"homepage": "https://github.com/heroku/heroku-cli-util", | ||
@@ -49,0 +53,0 @@ "license": "ISC", |
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
237171
13
2698
31