Comparing version 17.6.2 to 17.7.2
@@ -134,2 +134,3 @@ import { assertNotStrictEqual, } from './typings/common-types.js'; | ||
if (isCommandBuilderCallback(builder)) { | ||
yargs.getInternalMethods().getUsageInstance().freeze(); | ||
const builderOutput = builder(yargs.getInternalMethods().reset(aliases), helpOrVersionSet); | ||
@@ -144,2 +145,3 @@ if (isPromise(builderOutput)) { | ||
else if (isCommandBuilderOptionDefinitions(builder)) { | ||
yargs.getInternalMethods().getUsageInstance().freeze(); | ||
innerYargs = yargs.getInternalMethods().reset(aliases); | ||
@@ -146,0 +148,0 @@ Object.keys(commandHandler.builder).forEach(key => { |
@@ -74,5 +74,3 @@ import { isCommandBuilderCallback } from './command.js'; | ||
!this.argsContainKey(args, key, negable)) { | ||
this.completeOptionKey(key, completions, current); | ||
if (negable && !!options.default[key]) | ||
this.completeOptionKey(`no-${key}`, completions, current); | ||
this.completeOptionKey(key, completions, current, negable && !!options.default[key]); | ||
} | ||
@@ -157,15 +155,24 @@ }); | ||
} | ||
completeOptionKey(key, completions, current) { | ||
const descs = this.usage.getDescriptions(); | ||
completeOptionKey(key, completions, current, negable) { | ||
var _a, _b, _c, _d; | ||
let keyWithDesc = key; | ||
if (this.zshShell) { | ||
const descs = this.usage.getDescriptions(); | ||
const aliasKey = (_b = (_a = this === null || this === void 0 ? void 0 : this.aliases) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.find(alias => { | ||
const desc = descs[alias]; | ||
return typeof desc === 'string' && desc.length > 0; | ||
}); | ||
const descFromAlias = aliasKey ? descs[aliasKey] : undefined; | ||
const desc = (_d = (_c = descs[key]) !== null && _c !== void 0 ? _c : descFromAlias) !== null && _d !== void 0 ? _d : ''; | ||
keyWithDesc = `${key.replace(/:/g, '\\:')}:${desc | ||
.replace('__yargsString__:', '') | ||
.replace(/(\r\n|\n|\r)/gm, ' ')}`; | ||
} | ||
const startsByTwoDashes = (s) => /^--/.test(s); | ||
const isShortOption = (s) => /^[^0-9]$/.test(s); | ||
const dashes = !startsByTwoDashes(current) && isShortOption(key) ? '-' : '--'; | ||
if (!this.zshShell) { | ||
completions.push(dashes + key); | ||
completions.push(dashes + keyWithDesc); | ||
if (negable) { | ||
completions.push(dashes + 'no-' + keyWithDesc); | ||
} | ||
else { | ||
const desc = descs[key] || ''; | ||
completions.push(dashes + | ||
`${key.replace(/:/g, '\\:')}:${desc.replace('__yargsString__:', '')}`); | ||
} | ||
} | ||
@@ -172,0 +179,0 @@ customCompletion(args, argv, current, done) { |
@@ -349,3 +349,5 @@ import { objFilter } from './utils/obj-filter.js'; | ||
}, desc); | ||
if (extra) | ||
const shouldHideOptionExtras = yargs.getInternalMethods().getUsageConfiguration()['hide-types'] === | ||
true; | ||
if (extra && !shouldHideOptionExtras) | ||
ui.div({ text: extra, padding: [0, 0, 0, 2], align: 'right' }); | ||
@@ -352,0 +354,0 @@ else |
@@ -36,2 +36,6 @@ { | ||
}, | ||
"Unknown command: %s": { | ||
"one": "Unknown command: %s", | ||
"other": "Unknown commands: %s" | ||
}, | ||
"Invalid values:": "Invalid values:", | ||
@@ -38,0 +42,0 @@ "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Given: %s, Choices: %s", |
{ | ||
"name": "yargs", | ||
"version": "17.6.2", | ||
"version": "17.7.2", | ||
"description": "yargs the modern, pirate-themed, successor to optimist.", | ||
@@ -5,0 +5,0 @@ "main": "./index.cjs", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
292421
62
5274