Comparing version 13.1.0 to 13.2.0
@@ -15,3 +15,3 @@ 'use strict' | ||
let position = 0 | ||
let parsed = {demanded: [], optional: []} | ||
let parsed = { demanded: [], optional: [] } | ||
if (typeof expected === 'object') { | ||
@@ -18,0 +18,0 @@ length = callerArguments |
@@ -5,3 +5,3 @@ 'use strict' | ||
const isPromise = require('./is-promise') | ||
const {applyMiddleware, commandMiddlewareFactory} = require('./middleware') | ||
const { applyMiddleware, commandMiddlewareFactory } = require('./middleware') | ||
const path = require('path') | ||
@@ -8,0 +8,0 @@ const Parser = require('yargs-parser') |
@@ -12,2 +12,3 @@ 'use strict' | ||
const zshShell = process.env.SHELL && process.env.SHELL.indexOf('zsh') !== -1 | ||
// get a list of completion commands. | ||
@@ -62,3 +63,8 @@ // 'args' is the array of strings from the line to be completed | ||
if (args.indexOf(commandName) === -1) { | ||
completions.push(commandName) | ||
if (!zshShell) { | ||
completions.push(commandName) | ||
} else { | ||
const desc = usageCommand[1] || '' | ||
completions.push(commandName.replace(/:/g, '\\:') + ':' + desc) | ||
} | ||
} | ||
@@ -69,2 +75,3 @@ }) | ||
if (current.match(/^-/)) { | ||
const descs = usage.getDescriptions() | ||
Object.keys(yargs.getOptions().key).forEach((key) => { | ||
@@ -75,3 +82,8 @@ // If the key and its aliases aren't in 'args', add the key to 'completions' | ||
if (notInArgs) { | ||
completions.push(`--${key}`) | ||
if (!zshShell) { | ||
completions.push(`--${key}`) | ||
} else { | ||
const desc = descs[key] || '' | ||
completions.push(`--${key.replace(/:/g, '\\:')}:${desc}`) | ||
} | ||
} | ||
@@ -87,3 +99,3 @@ }) | ||
let script = fs.readFileSync( | ||
path.resolve(__dirname, '../completion.sh.hbs'), | ||
path.resolve(__dirname, zshShell ? '../completion.zsh.hbs' : '../completion.sh.hbs'), | ||
'utf-8' | ||
@@ -90,0 +102,0 @@ ) |
@@ -184,3 +184,3 @@ 'use strict' | ||
if (usage[1]) { | ||
ui.div({text: `${usage[1]}`, padding: [1, 0, 0, 0]}) | ||
ui.div({ text: `${usage[1]}`, padding: [1, 0, 0, 0] }) | ||
} | ||
@@ -221,3 +221,3 @@ }) | ||
}, | ||
{text: command[1]} | ||
{ text: command[1] } | ||
) | ||
@@ -230,3 +230,3 @@ const hints = [] | ||
if (hints.length) { | ||
ui.div({text: hints.join(' '), padding: [0, 0, 0, 2], align: 'right'}) | ||
ui.div({ text: hints.join(' '), padding: [0, 0, 0, 2], align: 'right' }) | ||
} else { | ||
@@ -307,7 +307,7 @@ ui.div() | ||
ui.span( | ||
{text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches, theWrap) + 4}, | ||
{ text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches, theWrap) + 4 }, | ||
desc | ||
) | ||
if (extra) ui.div({text: extra, padding: [0, 0, 0, 2], align: 'right'}) | ||
if (extra) ui.div({ text: extra, padding: [0, 0, 0, 2], align: 'right' }) | ||
else ui.div() | ||
@@ -314,0 +314,0 @@ }) |
{ | ||
"name": "yargs", | ||
"version": "13.1.0", | ||
"version": "13.2.0", | ||
"description": "yargs the modern, pirate-themed, successor to optimist.", | ||
@@ -44,4 +44,4 @@ "main": "./index.js", | ||
"rimraf": "^2.6.3", | ||
"standard": "^11.0.1", | ||
"standard-version": "^4.4.0", | ||
"standard": "^12.0.1", | ||
"standard-version": "^5.0.0", | ||
"which": "^1.3.1", | ||
@@ -48,0 +48,0 @@ "yargs-test-extends": "^1.0.1" |
@@ -14,3 +14,3 @@ 'use strict' | ||
const applyExtends = require('./lib/apply-extends') | ||
const {globalMiddlewareFactory} = require('./lib/middleware') | ||
const { globalMiddlewareFactory } = require('./lib/middleware') | ||
const YError = require('./lib/yerror') | ||
@@ -907,3 +907,3 @@ | ||
if (!desc && desc !== false) { | ||
desc = 'generate bash completion script' | ||
desc = 'generate completion script' | ||
} | ||
@@ -910,0 +910,0 @@ self.command(completionCommand, desc) |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
225380
3450
12