listr-update-renderer
Advanced tools
Comparing version 0.1.2 to 0.1.3
16
index.js
@@ -20,7 +20,15 @@ 'use strict'; | ||
if ((task.isPending() || task.isSkipped()) && task.output) { | ||
const lastLine = task.output.trim().split('\n').filter(Boolean).pop(); | ||
if ((task.isPending() || task.isSkipped()) && utils.isDefined(task.output)) { | ||
let data = task.output; | ||
if (lastLine) { | ||
const out = indentString(`${figures.arrowRight} ${stripAnsi(lastLine.trim())}`, level, ' '); | ||
if (typeof data === 'string') { | ||
data = stripAnsi(data.trim().split('\n').filter(Boolean).pop()); | ||
if (data.length === 0) { | ||
data = undefined; | ||
} | ||
} | ||
if (utils.isDefined(data)) { | ||
const out = indentString(`${figures.arrowRight} ${data}`, level, ' '); | ||
output.push(` ${chalk.gray(cliTruncate(out, process.stdout.columns - 3))}`); | ||
@@ -27,0 +35,0 @@ } |
@@ -10,2 +10,4 @@ 'use strict'; | ||
exports.isDefined = x => x !== null && x !== undefined; | ||
exports.getSymbol = (task, options) => { | ||
@@ -12,0 +14,0 @@ if (!task.spinner) { |
{ | ||
"name": "listr-update-renderer", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Listr update renderer", | ||
@@ -41,3 +41,6 @@ "license": "MIT", | ||
"devDependencies": { | ||
"xo": "*" | ||
"delay": "^1.3.1", | ||
"listr": "^0.9.0", | ||
"xo": "*", | ||
"zen-observable": "^0.4.0" | ||
}, | ||
@@ -44,0 +47,0 @@ "xo": { |
6411
89
4