cli-engine-command
Advanced tools
Comparing version 8.0.13 to 8.0.14
@@ -7,6 +7,2 @@ 'use strict'; | ||
var _output = require('./output'); | ||
var _output2 = _interopRequireDefault(_output); | ||
var _parser = require('./parser'); | ||
@@ -72,4 +68,3 @@ | ||
const { CLI } = require('cli-ux'); | ||
this.cli = new CLI({ mock: this.config.mock }); | ||
this.out = new _output2.default(this.config); | ||
this.out = new CLI({ mock: this.config.mock }); | ||
this.http = _httpCall2.default.defaults({ | ||
@@ -76,0 +71,0 @@ headers: { |
@@ -7,10 +7,6 @@ 'use strict'; | ||
var _screen = require('./output/screen'); | ||
var _screen = require('./screen'); | ||
var _output = require('./output'); | ||
var _color = require('./color'); | ||
var _output2 = _interopRequireDefault(_output); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function linewrap(length, s) { | ||
@@ -54,18 +50,16 @@ const linewrap = require('@heroku/linewrap'); | ||
constructor(config, output) { | ||
constructor(config) { | ||
this.config = config; | ||
this.out = output || new _output2.default(config); | ||
} | ||
command(cmd) { | ||
let color = this.out.color; | ||
let flags = Object.entries(cmd.flags || {}).filter(([name, flag]) => !flag.hidden); | ||
let args = (cmd.args || []).filter(a => !a.hidden); | ||
let hasFlags = flags.length ? ` ${color.blue('[flags]')}` : ''; | ||
let usage = `${color.bold('Usage:')} ${this.config.bin} ${buildUsage(cmd)}${hasFlags}\n`; | ||
return [usage, cmd.description ? `\n${color.bold(cmd.description.trim())}\n` : '', this.renderAliases(cmd.aliases), this.renderArgs(args), this.renderFlags(flags), cmd.help ? `\n${cmd.help.trim()}\n` : ''].join(''); | ||
let hasFlags = flags.length ? ` ${_color.color.blue('[flags]')}` : ''; | ||
let usage = `${_color.color.bold('Usage:')} ${this.config.bin} ${buildUsage(cmd)}${hasFlags}\n`; | ||
return [usage, cmd.description ? `\n${_color.color.bold(cmd.description.trim())}\n` : '', this.renderAliases(cmd.aliases), this.renderArgs(args), this.renderFlags(flags), cmd.help ? `\n${cmd.help.trim()}\n` : ''].join(''); | ||
} | ||
commandLine(cmd) { | ||
return [buildUsage(cmd), cmd.description ? this.out.color.dim(cmd.description) : null]; | ||
return [buildUsage(cmd), cmd.description ? _color.color.dim(cmd.description) : null]; | ||
} | ||
@@ -76,3 +70,3 @@ | ||
let a = aliases.map(a => ` $ ${this.config.bin} ${a}`).join('\n'); | ||
return `\n${this.out.color.blue('Aliases:')}\n${a}\n`; | ||
return `\n${_color.color.blue('Aliases:')}\n${a}\n`; | ||
} | ||
@@ -83,3 +77,3 @@ | ||
return '\n' + renderList(args.map(a => { | ||
return [a.name.toUpperCase(), a.description ? this.out.color.dim(a.description) : null]; | ||
return [a.name.toUpperCase(), a.description ? _color.color.dim(a.description) : null]; | ||
})) + '\n'; | ||
@@ -96,3 +90,3 @@ } | ||
}); | ||
return `\n${this.out.color.blue('Flags:')}\n` + renderList(flags.map(([name, f]) => { | ||
return `\n${_color.color.blue('Flags:')}\n` + renderList(flags.map(([name, f]) => { | ||
let label = []; | ||
@@ -104,3 +98,3 @@ if (f.char) label.push(`-${f.char}`); | ||
if (f.required || f.optional === false) description = `(required) ${description}`; | ||
return [` ${label.join(',').trim()}` + usage, description ? this.out.color.dim(description) : null]; | ||
return [` ${label.join(',').trim()}` + usage, description ? _color.color.dim(description) : null]; | ||
})) + '\n'; | ||
@@ -107,0 +101,0 @@ } |
@@ -7,4 +7,3 @@ 'use strict'; | ||
class Topic { | ||
constructor(commands, out) { | ||
this.out = out; | ||
constructor(commands) { | ||
this.commands = commands; | ||
@@ -11,0 +10,0 @@ } |
{ | ||
"name": "cli-engine-command", | ||
"description": "base CLI command for cli-engine", | ||
"version": "8.0.13", | ||
"version": "8.0.14", | ||
"author": "Jeff Dickey @dickeyxxx", | ||
@@ -11,16 +11,7 @@ "bugs": "https://github.com/heroku/cli-engine-command/issues", | ||
"cardinal": "1.x", | ||
"chalk": "^1.0.0", | ||
"cli-ux": "^1.0.0", | ||
"chalk": "^2.1.0", | ||
"cli-ux": "^1.0.1", | ||
"fs-extra": "^4.0.1", | ||
"http-call": "^3.0.2", | ||
"lodash.ary": "^4.1.1", | ||
"lodash.defaults": "^4.2.0", | ||
"lodash.get": "^4.4.2", | ||
"lodash.identity": "^3.0.0", | ||
"lodash.keys": "^4.2.0", | ||
"lodash.maxby": "4.x", | ||
"lodash.merge": "4.x", | ||
"lodash.partial": "^4.2.1", | ||
"lodash.property": "^4.4.2", | ||
"lodash.result": "^4.5.2", | ||
"lodash.maxby": "^4.6.0", | ||
"moment": "^2.18.1", | ||
@@ -33,3 +24,3 @@ "string": "3.x", | ||
"babel-eslint": "7.2.3", | ||
"babel-jest": "^21.0.0", | ||
"babel-jest": "^21.0.2", | ||
"babel-plugin-syntax-object-rest-spread": "^6.13.0", | ||
@@ -39,3 +30,3 @@ "babel-plugin-transform-class-properties": "6.24.1", | ||
"babel-plugin-transform-flow-strip-types": "6.22.0", | ||
"cli-engine-config": "^3.1.6", | ||
"cli-engine-config": "^3.2.0", | ||
"eslint": "^4.6.1", | ||
@@ -45,3 +36,3 @@ "eslint-config-standard": "10.2.1", | ||
"eslint-plugin-import": "^2.7.0", | ||
"eslint-plugin-jest": "^21.0.0", | ||
"eslint-plugin-jest": "^21.0.2", | ||
"eslint-plugin-node": "^5.1.0", | ||
@@ -54,3 +45,3 @@ "eslint-plugin-promise": "3.5.0", | ||
"husky": "^0.14.3", | ||
"jest": "^21.0.1", | ||
"jest": "^21.0.2", | ||
"jest-junit": "^3.0.0", | ||
@@ -57,0 +48,0 @@ "lint-staged": "^4.1.3", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
12
2
29167
24
402
2
- Removedlodash.ary@^4.1.1
- Removedlodash.defaults@^4.2.0
- Removedlodash.get@^4.4.2
- Removedlodash.identity@^3.0.0
- Removedlodash.keys@^4.2.0
- Removedlodash.merge@4.x
- Removedlodash.partial@^4.2.1
- Removedlodash.property@^4.4.2
- Removedlodash.result@^4.5.2
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedchalk@1.1.3(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedlodash.ary@4.1.1(transitive)
- Removedlodash.defaults@4.2.0(transitive)
- Removedlodash.get@4.4.2(transitive)
- Removedlodash.identity@3.0.0(transitive)
- Removedlodash.keys@4.2.0(transitive)
- Removedlodash.merge@4.6.2(transitive)
- Removedlodash.partial@4.2.1(transitive)
- Removedlodash.property@4.4.2(transitive)
- Removedlodash.result@4.5.2(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.0(transitive)
Updatedchalk@^2.1.0
Updatedcli-ux@^1.0.1
Updatedlodash.maxby@^4.6.0