Comparing version 6.0.0 to 6.0.1
@@ -5,2 +5,9 @@ # Changelog | ||
### [6.0.1](https://github.com/oclif/cli-ux/compare/v6.0.0...v6.0.1) (2021-12-01) | ||
### Bug Fixes | ||
* bump deps and correct/suppress lint errors ([#450](https://github.com/oclif/cli-ux/issues/450)) ([bc0935c](https://github.com/oclif/cli-ux/commit/bc0935ccfdf049f738be142bd3346ff34b7b1358)) | ||
## [6.0.0](https://github.com/oclif/cli-ux/compare/v5.6.3...v6.0.0) (2021-10-04) | ||
@@ -7,0 +14,0 @@ |
@@ -151,3 +151,3 @@ "use strict"; | ||
let std; | ||
while (this.stdmocks && this.stdmocks.length) { | ||
while (this.stdmocks && this.stdmocks.length > 0) { | ||
const cur = this.stdmocks.shift(); | ||
@@ -154,0 +154,0 @@ std = cur[0]; |
@@ -21,3 +21,3 @@ "use strict"; | ||
return s; | ||
const has256 = supportsColor.stdout.has256 || (process.env.TERM || '').indexOf('256') !== -1; | ||
const has256 = supportsColor.stdout.has256 || (process.env.TERM || '').includes('256'); | ||
const prideColor = prideColors[frameIndex] || prideColors[0]; | ||
@@ -24,0 +24,0 @@ return has256 ? prideColor(s) : chalk_1.default.magenta(s); |
@@ -14,3 +14,3 @@ "use strict"; | ||
return s; | ||
const has256 = supportsColor.stdout.has256 || (process.env.TERM || '').indexOf('256') !== -1; | ||
const has256 = supportsColor.stdout.has256 || (process.env.TERM || '').includes('256'); | ||
return has256 ? `\u001B[38;5;104m${s}${deps_1.default.ansiStyles.reset.open}` : chalk_1.default.magenta(s); | ||
@@ -17,0 +17,0 @@ } |
@@ -17,2 +17,19 @@ "use strict"; | ||
exports.Table = Table; | ||
function timeout(p, ms) { | ||
function wait(ms, unref = false) { | ||
return new Promise(resolve => { | ||
const t = setTimeout(() => resolve(null), ms); | ||
if (unref) | ||
t.unref(); | ||
}); | ||
} | ||
return Promise.race([p, wait(ms, true).then(() => exports.ux.error('timed out'))]); | ||
} | ||
async function flush() { | ||
const p = new Promise(resolve => { | ||
process.stdout.once('drain', () => resolve(null)); | ||
}); | ||
process.stdout.write(''); | ||
return p; | ||
} | ||
exports.ux = { | ||
@@ -106,17 +123,2 @@ config: config_1.config, | ||
async flush() { | ||
function timeout(p, ms) { | ||
function wait(ms, unref = false) { | ||
return new Promise(resolve => { | ||
const t = setTimeout(() => resolve(null), ms); | ||
if (unref) | ||
t.unref(); | ||
}); | ||
} | ||
return Promise.race([p, wait(ms, true).then(() => exports.ux.error('timed out'))]); | ||
} | ||
async function flush() { | ||
const p = new Promise(resolve => process.stdout.once('drain', () => resolve(null))); | ||
process.stdout.write(''); | ||
return p; | ||
} | ||
await timeout(flush(), 10000); | ||
@@ -123,0 +125,0 @@ }, |
@@ -37,15 +37,9 @@ "use strict"; | ||
if (appArgs.length > 0) { | ||
args = args.concat(appArgs); | ||
args = [...args, ...appArgs]; | ||
} | ||
} | ||
else { | ||
if (opts.app) { | ||
cmd = opts.app; | ||
} | ||
else { | ||
// try local xdg-open | ||
cmd = 'xdg-open'; | ||
} | ||
cmd = opts.app ? opts.app : 'xdg-open'; | ||
if (appArgs.length > 0) { | ||
args = args.concat(appArgs); | ||
args = [...args, ...appArgs]; | ||
} | ||
@@ -63,3 +57,3 @@ // if (!opts.wait) { | ||
args.push('--args'); | ||
args = args.concat(appArgs); | ||
args = [...args, ...appArgs]; | ||
} | ||
@@ -66,0 +60,0 @@ const cp = childProcess.spawn(cmd, args, cpOpts); |
@@ -54,3 +54,3 @@ "use strict"; | ||
if (typeof val !== 'string') | ||
val = (0, util_1.inspect)(val, { breakLength: Infinity }); | ||
val = (0, util_1.inspect)(val, { breakLength: Number.POSITIVE_INFINITY }); | ||
row[col.key] = val; | ||
@@ -66,3 +66,3 @@ } | ||
if (isNot) | ||
header = header.substr(1); | ||
header = header.slice(1); | ||
const col = this.findColumnFromHeader(header); | ||
@@ -81,3 +81,3 @@ if (!col || !regex) | ||
const sorters = this.options.sort.split(','); | ||
const sortHeaders = sorters.map(k => k[0] === '-' ? k.substr(1) : k); | ||
const sortHeaders = sorters.map(k => k[0] === '-' ? k.slice(1) : k); | ||
const sortKeys = this.filterColumnsFromHeaders(sortHeaders).map(c => { | ||
@@ -120,7 +120,7 @@ return ((v) => v[c.key]); | ||
const cols = []; | ||
filters.forEach(f => { | ||
for (const f of filters) { | ||
const c = this.columns.find(c => c.header.toLowerCase() === f.toLowerCase()); | ||
if (c) | ||
cols.push(c); | ||
}); | ||
} | ||
return cols; | ||
@@ -130,8 +130,3 @@ } | ||
const values = this.columns.map(col => d[col.key] || ''); | ||
const needToBeEscapedForCsv = (e) => { | ||
// CSV entries containing line breaks, comma or double quotes | ||
// as specified in https://tools.ietf.org/html/rfc4180#section-2 | ||
return e.includes('"') || e.includes('\n') || e.includes('\r\n') || e.includes('\r') || e.includes(','); | ||
}; | ||
const lineToBeEscaped = values.find(needToBeEscapedForCsv); | ||
const lineToBeEscaped = values.find((e) => e.includes('"') || e.includes('\n') || e.includes('\r\n') || e.includes('\r') || e.includes(',')); | ||
return values.map(e => lineToBeEscaped ? `"${e.replace('"', '""')}"` : e); | ||
@@ -143,2 +138,3 @@ } | ||
return data.map((d) => { | ||
// eslint-disable-next-line unicorn/prefer-object-from-entries | ||
return columns.reduce((obj, col) => { | ||
@@ -161,6 +157,6 @@ return Object.assign(Object.assign({}, obj), { [col.key]: d[col.key] || '' }); | ||
} | ||
data.forEach((d) => { | ||
for (const d of data) { | ||
const row = this.getCSVRow(d); | ||
options.printLine(row.join(',')); | ||
}); | ||
} | ||
} | ||
@@ -265,6 +261,7 @@ outputTable() { | ||
} | ||
// eslint-disable-next-line unicorn/no-new-array | ||
const linesIndexess = [...new Array(numOfLines).keys()]; | ||
// print row | ||
// including multi-lines | ||
linesIndexess.forEach((i) => { | ||
for (const i of linesIndexess) { | ||
let l = options.rowStart; | ||
@@ -284,3 +281,3 @@ for (const col of columns) { | ||
options.printLine(l); | ||
}); | ||
} | ||
} | ||
@@ -314,7 +311,7 @@ } | ||
const e = (opts.except && typeof opts.except === 'string' ? [opts.except] : opts.except) || []; | ||
o.forEach((key) => { | ||
if (e.includes(key)) | ||
return; | ||
f[key] = table.Flags[key]; | ||
}); | ||
for (const key of o) { | ||
if (!e.includes(key)) { | ||
f[key] = table.Flags[key]; | ||
} | ||
} | ||
return f; | ||
@@ -321,0 +318,0 @@ } |
@@ -5,3 +5,5 @@ "use strict"; | ||
exports.default = (ms = 1000) => { | ||
return new Promise(resolve => setTimeout(resolve, ms)); | ||
return new Promise(resolve => { | ||
setTimeout(resolve, ms); | ||
}); | ||
}; |
{ | ||
"name": "cli-ux", | ||
"description": "cli IO utilities", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"author": "Jeff Dickey @jdxcode", | ||
"bugs": "https://github.com/oclif/cli-ux/issues", | ||
"dependencies": { | ||
"@oclif/core": "^0.5.39", | ||
"@oclif/core": "^1.0.4", | ||
"@oclif/linewrap": "^1.0.0", | ||
@@ -23,3 +23,3 @@ "@oclif/screen": "^1.0.3", | ||
"js-yaml": "^3.13.1", | ||
"lodash": "^4.17.11", | ||
"lodash": "^4.17.21", | ||
"natural-orderby": "^2.0.1", | ||
@@ -52,4 +52,4 @@ "object-treeify": "^1.1.4", | ||
"chai-as-promised": "^7.1.1", | ||
"eslint": "^7.5.0", | ||
"eslint-config-oclif": "^3.1.0", | ||
"eslint": "^7.32.0", | ||
"eslint-config-oclif": "^4.0.0", | ||
"eslint-config-oclif-typescript": "^1.0.2", | ||
@@ -56,0 +56,0 @@ "fancy-test": "^1.4.1", |
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
98694
1922
+ Added@oclif/core@1.26.2(transitive)
+ Added@oclif/screen@3.0.8(transitive)
+ Addedasync@3.2.6(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.112.0.1(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedejs@3.1.10(transitive)
+ Addedfilelist@1.0.4(transitive)
+ Addedjake@10.9.2(transitive)
+ Addedminimatch@3.1.25.1.6(transitive)
- Removed@oclif/command@1.8.36(transitive)
- Removed@oclif/config@1.18.161.18.17(transitive)
- Removed@oclif/core@0.5.41(transitive)
- Removed@oclif/errors@1.3.6(transitive)
- Removed@oclif/help@1.0.15(transitive)
- Removed@oclif/parser@3.8.17(transitive)
- Removedcli-ux@5.6.7(transitive)
- Removedlodash._reinterpolate@3.0.0(transitive)
- Removedlodash.template@4.5.0(transitive)
- Removedlodash.templatesettings@4.2.0(transitive)
- Removedwrap-ansi@6.2.0(transitive)
Updated@oclif/core@^1.0.4
Updatedlodash@^4.17.21