@oclif/core
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -0,1 +1,11 @@ | ||
## [0.1.1](https://github.com/oclif/core/compare/v0.1.0...v0.1.1) (2020-09-09) | ||
### Bug Fixes | ||
* accept integer 0 as valid arg input ([#34](https://github.com/oclif/core/issues/34)) ([36eb02f](https://github.com/oclif/core/commit/36eb02f168eaa179e260010443fd33e526a94763)) | ||
* support src/commands/index cmd ([#35](https://github.com/oclif/core/issues/35)) ([2c14c3c](https://github.com/oclif/core/commit/2c14c3c0987e9cf97ff1d34648cf4a0a90e595d2)) | ||
# 0.1.0 (2020-09-02) | ||
@@ -2,0 +12,0 @@ |
@@ -5,2 +5,3 @@ "use strict"; | ||
const help_1 = require("../help"); | ||
const ROOT_INDEX_CMD_ID = ''; | ||
class Main extends _1.Command { | ||
@@ -16,3 +17,3 @@ static run(argv = process.argv.slice(2), options) { | ||
async run() { | ||
const [id, ...argv] = this.argv; | ||
let [id, ...argv] = this.argv; | ||
this.parse(Object.assign({ strict: false, '--': false }, this.ctor)); | ||
@@ -23,2 +24,6 @@ if (!this.config.findCommand(id)) { | ||
return this._help(); | ||
if (this.config.findCommand(ROOT_INDEX_CMD_ID)) { | ||
id = ROOT_INDEX_CMD_ID; | ||
argv = this.argv; | ||
} | ||
} | ||
@@ -32,3 +37,3 @@ await this.config.runCommand(id, argv); | ||
return true; | ||
if (this.argv.length === 0) | ||
if (this.argv.length === 0 && !this.config.findCommand(ROOT_INDEX_CMD_ID)) | ||
return true; | ||
@@ -35,0 +40,0 @@ for (const arg of this.argv) { |
@@ -10,2 +10,3 @@ "use strict"; | ||
const util_2 = require("./util"); | ||
const ROOT_INDEX_CMD_ID = ''; | ||
const _pjson = require('../../package.json'); | ||
@@ -151,2 +152,5 @@ const hasManifest = function (p) { | ||
const command = p.name !== 'index' && p.name; | ||
// support src/commands/index as a "root" command | ||
if (!command && this.type === 'core' && p.dir.length === 0 && p.name === 'index') | ||
return ROOT_INDEX_CMD_ID; | ||
return [...topics, command].filter(f => f).join(':'); | ||
@@ -153,0 +157,0 @@ }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const chalk_1 = require("chalk"); | ||
const Chalk = require("chalk"); | ||
const indent = require("indent-string"); | ||
@@ -8,6 +8,6 @@ const stripAnsi = require("strip-ansi"); | ||
const util_1 = require("./util"); | ||
const { underline, bold, } = chalk_1.default; | ||
let { dim, } = chalk_1.default; | ||
const { underline, bold, } = Chalk; | ||
let { dim, } = Chalk; | ||
if (process.env.ConEmuANSI === 'ON') { | ||
dim = chalk_1.default.gray; | ||
dim = Chalk.gray; | ||
} | ||
@@ -14,0 +14,0 @@ const wrap = require('wrap-ansi'); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const errors_1 = require("../errors"); | ||
const chalk_1 = require("chalk"); | ||
const Chalk = require("chalk"); | ||
const indent = require("indent-string"); | ||
@@ -15,3 +15,4 @@ const stripAnsi = require("strip-ansi"); | ||
const wrap = require('wrap-ansi'); | ||
const { bold, } = chalk_1.default; | ||
const { bold, } = Chalk; | ||
const ROOT_INDEX_CMD_ID = ''; | ||
function getHelpSubject(args) { | ||
@@ -21,6 +22,6 @@ for (const arg of args) { | ||
return; | ||
if (arg === 'help' || arg === '--help' || arg === '-h') | ||
continue; | ||
if (arg.startsWith('-')) | ||
continue; | ||
if (arg === 'help') | ||
continue; | ||
return; | ||
return arg; | ||
@@ -71,2 +72,5 @@ } | ||
if (!subject) { | ||
const rootCmd = this.config.findCommand(ROOT_INDEX_CMD_ID); | ||
if (rootCmd) | ||
this.showCommandHelp(rootCmd); | ||
this.showRootHelp(); | ||
@@ -120,2 +124,3 @@ return; | ||
if (rootCommands.length > 0) { | ||
rootCommands = rootCommands.filter(c => c.id); | ||
console.log(this.formatCommands(rootCommands)); | ||
@@ -122,0 +127,0 @@ console.log(''); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const chalk_1 = require("chalk"); | ||
const Chalk = require("chalk"); | ||
const indent = require("indent-string"); | ||
@@ -8,3 +8,3 @@ const stripAnsi = require("strip-ansi"); | ||
const wrap = require('wrap-ansi'); | ||
const { bold, } = chalk_1.default; | ||
const { bold, } = Chalk; | ||
class RootHelp { | ||
@@ -11,0 +11,0 @@ constructor(config, opts) { |
@@ -24,3 +24,3 @@ "use strict"; | ||
if (arg.required) { | ||
if (!parse.output.argv[index]) { | ||
if (!parse.output.argv[index] && parse.output.argv[index] !== 0) { | ||
missingRequiredArgs.push(arg); | ||
@@ -27,0 +27,0 @@ } |
{ | ||
"name": "@oclif/core", | ||
"description": "base library for oclif CLIs", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"author": "Jeff Dickey @jdxcode", | ||
@@ -9,3 +9,3 @@ "bugs": "https://github.com/oclif/core/issues", | ||
"@oclif/linewrap": "^1.0.0", | ||
"chalk": "^2.4.2", | ||
"chalk": "^4.1.0", | ||
"clean-stack": "^3.0.0", | ||
@@ -38,3 +38,3 @@ "cli-ux": "^5.1.0", | ||
"@types/lodash.template": "^4.4.4", | ||
"@types/mocha": "^7.0.2", | ||
"@types/mocha": "^8.0.3", | ||
"@types/nock": "^11.1.0", | ||
@@ -56,7 +56,7 @@ "@types/node": "^14.0.14", | ||
"lodash": "^4.17.11", | ||
"mocha": "^6.1.4", | ||
"mocha": "^8.1.3", | ||
"nock": "^13.0.0", | ||
"proxyquire": "^2.1.0", | ||
"sinon": "^9.0.1", | ||
"ts-node": "^8.1.0", | ||
"ts-node": "^9.0.0", | ||
"typescript": "3.8.3" | ||
@@ -91,3 +91,3 @@ }, | ||
"prepack": "yarn run build", | ||
"test": "mocha --forbid-only \"test/**/*.test.ts\"", | ||
"test": "mocha --forbid-only \"test/**/*.test.ts\" --no-color", | ||
"version": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md", | ||
@@ -94,0 +94,0 @@ "pretest": "yarn build --noEmit && tsc -p test --noEmit" |
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
143186
4032
- Removedansi-styles@3.2.1(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedsupports-color@5.5.0(transitive)
Updatedchalk@^4.1.0