Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

yargs

Package Overview
Dependencies
Maintainers
3
Versions
250
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yargs - npm Package Compare versions

Comparing version 13.3.0 to 14.0.0

10

index.js

@@ -28,6 +28,14 @@ 'use strict'

Argv.__defineGetter__(key, inst.__lookupGetter__(key))
} else if (typeof inst[key] === 'function') {
Argv[key] = inst[key].bind(inst)
} else {
Argv[key] = typeof inst[key] === 'function' ? inst[key].bind(inst) : inst[key]
Argv.__defineGetter__('$0', () => {
return inst.$0
})
Argv.__defineGetter__('parsed', () => {
console.warn('In future major releases of yargs, "parsed" will be a private field. Use the return value of ".parse()" or ".argv" instead')
return inst.parsed
})
}
})
}

2

lib/apply-extends.js

@@ -22,3 +22,3 @@

if (config.hasOwnProperty('extends')) {
if (Object.prototype.hasOwnProperty.call(config, 'extends')) {
if (typeof config.extends !== 'string') return defaultConfig

@@ -25,0 +25,0 @@ const isPath = /\.json|\..*rc$/.test(config.extends)

@@ -189,20 +189,13 @@ 'use strict'

innerYargs = commandHandler.builder(yargs.reset(parsed.aliases))
// if the builder function did not yet parse argv with reset yargs
// and did not explicitly set a usage() string, then apply the
// original command string as usage() for consistent behavior with
// options object below.
if (yargs.parsed === false) {
if (shouldUpdateUsage(yargs)) {
yargs.getUsageInstance().usage(
usageFromParentCommandsCommandHandler(parentCommands, commandHandler),
commandHandler.description
)
}
innerArgv = innerYargs ? innerYargs._parseArgs(null, null, true, commandIndex) : yargs._parseArgs(null, null, true, commandIndex)
} else {
innerArgv = yargs.parsed.argv
if (!innerYargs || (typeof innerYargs._parseArgs !== 'function')) {
innerYargs = yargs
}
if (innerYargs && yargs.parsed === false) aliases = innerYargs.parsed.aliases
else aliases = yargs.parsed.aliases
if (shouldUpdateUsage(innerYargs)) {
innerYargs.getUsageInstance().usage(
usageFromParentCommandsCommandHandler(parentCommands, commandHandler),
commandHandler.description
)
}
innerArgv = innerYargs._parseArgs(null, null, true, commandIndex)
aliases = innerYargs.parsed.aliases
} else if (typeof commandHandler.builder === 'object') {

@@ -423,5 +416,6 @@ // as a short hand, an object can instead be provided, specifying

// with the same yargs instance.
let frozen
let frozens = []
self.freeze = () => {
frozen = {}
let frozen = {}
frozens.push(frozen)
frozen.handlers = handlers

@@ -432,6 +426,6 @@ frozen.aliasMap = aliasMap

self.unfreeze = () => {
let frozen = frozens.pop()
handlers = frozen.handlers
aliasMap = frozen.aliasMap
defaultCommand = frozen.defaultCommand
frozen = undefined
}

@@ -438,0 +432,0 @@

'use strict'
// this file handles outputting usage instructions,
// failures, etc. keeps logging in one place.
const decamelize = require('./decamelize')
const decamelize = require('decamelize')
const stringWidth = require('string-width')

@@ -125,5 +125,5 @@ const objFilter = require('./obj-filter')

let epilog
let epilogs = []
self.epilog = (msg) => {
epilog = msg
epilogs.push(msg)
}

@@ -155,3 +155,3 @@

// handle old demanded API
const base$0 = path.basename(yargs.$0)
const base$0 = yargs.customScriptName ? yargs.$0 : path.basename(yargs.$0)
const demandedOptions = yargs.getDemandedOptions()

@@ -350,4 +350,4 @@ const demandedCommands = yargs.getDemandedCommands()

// the usage string.
if (epilog) {
const e = epilog.replace(/\$0/g, base$0)
if (epilogs.length > 0) {
const e = epilogs.map(epilog => epilog.replace(/\$0/g, base$0)).join('\n')
ui.div(`${e}\n`)

@@ -511,3 +511,3 @@ }

usageDisabled = false
epilog = undefined
epilogs = []
examples = []

@@ -519,5 +519,6 @@ commands = []

let frozen
let frozens = []
self.freeze = function freeze () {
frozen = {}
let frozen = {}
frozens.push(frozen)
frozen.failMessage = failMessage

@@ -527,3 +528,3 @@ frozen.failureOutput = failureOutput

frozen.usageDisabled = usageDisabled
frozen.epilog = epilog
frozen.epilogs = epilogs
frozen.examples = examples

@@ -534,2 +535,3 @@ frozen.commands = commands

self.unfreeze = function unfreeze () {
let frozen = frozens.pop()
failMessage = frozen.failMessage

@@ -539,7 +541,6 @@ failureOutput = frozen.failureOutput

usageDisabled = frozen.usageDisabled
epilog = frozen.epilog
epilogs = frozen.epilogs
examples = frozen.examples
commands = frozen.commands
descriptions = frozen.descriptions
frozen = undefined
}

@@ -546,0 +547,0 @@

@@ -105,3 +105,3 @@ 'use strict'

if (commandKeys.length > 0) {
if ((currentContext.commands.length > 0) || (commandKeys.length > 0)) {
argv._.slice(currentContext.commands.length).forEach((key) => {

@@ -327,5 +327,6 @@ if (commandKeys.indexOf(key) === -1) {

let frozen
let frozens = []
self.freeze = function freeze () {
frozen = {}
let frozen = {}
frozens.push(frozen)
frozen.implied = implied

@@ -336,6 +337,6 @@ frozen.checks = checks

self.unfreeze = function unfreeze () {
let frozen = frozens.pop()
implied = frozen.implied
checks = frozen.checks
conflicting = frozen.conflicting
frozen = undefined
}

@@ -342,0 +343,0 @@

{
"name": "yargs",
"version": "13.3.0",
"version": "14.0.0",
"description": "yargs the modern, pirate-themed, successor to optimist.",

@@ -23,2 +23,3 @@ "main": "./index.js",

"cliui": "^5.0.0",
"decamelize": "^1.2.0",
"find-up": "^3.0.0",

@@ -46,3 +47,3 @@ "get-caller-file": "^2.0.1",

"standard": "^12.0.1",
"standard-version": "^6.0.1",
"standard-version": "^7.0.0",
"which": "^1.3.1",

@@ -49,0 +50,0 @@ "yargs-test-extends": "^1.0.1"

@@ -8,2 +8,3 @@ <p align="center">

</p>
<br>

@@ -19,3 +20,3 @@

## Description :
Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.

@@ -91,2 +92,12 @@ It gives you:

## TypeScript
yargs has type definitions at [@types/yargs][type-definitions].
```
npm i @types/yargs --save-dev
```
See usage examples in [docs](/docs/typescript.md)
## Community :

@@ -108,2 +119,3 @@

* [Objects](/docs/tricks.md#objects)
* [Quotes](/docs/tricks.md#quotes)
* [Advanced Topics](/docs/advanced.md)

@@ -127,1 +139,2 @@ * [Composing Your App Using Commands](/docs/advanced.md#commands)

[slack-url]: http://devtoolscommunity.herokuapp.com
[type-definitions]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs

@@ -40,3 +40,4 @@ 'use strict'

self.scriptName = function scriptName (scriptName) {
self.scriptName = function (scriptName) {
self.customScriptName = true
self.$0 = scriptName

@@ -148,5 +149,6 @@ return self

// temporary hack: allow "freezing" of reset-able state for parse(msg, cb)
let frozen
let frozens = []
function freeze () {
frozen = {}
let frozen = {}
frozens.push(frozen)
frozen.options = options

@@ -165,4 +167,7 @@ frozen.configObjects = options.configObjects.slice(0)

frozen.parsed = self.parsed
frozen.parseFn = parseFn
frozen.parseContext = parseContext
}
function unfreeze () {
let frozen = frozens.pop()
options = frozen.options

@@ -181,5 +186,4 @@ options.configObjects = frozen.configObjects

completionCommand = frozen.completionCommand
parseFn = null
parseContext = null
frozen = undefined
parseFn = frozen.parseFn
parseContext = frozen.parseContext
}

@@ -545,4 +549,8 @@

argsert('[string|array] [function|boolean|object] [function]', [args, shortCircuit, _parseFn], arguments.length)
freeze()
if (typeof args === 'undefined') {
return self._parseArgs(processArgs)
const parsed = self._parseArgs(processArgs)
unfreeze()
// TODO: remove this compatibility hack when we release yargs@15.x:
return (this.parsed = parsed)
}

@@ -568,3 +576,2 @@

freeze()
if (parseFn) exitProcess = false

@@ -910,3 +917,3 @@

// register the completion command.
completionCommand = cmd || 'completion'
completionCommand = cmd || completionCommand || 'completion'
if (!desc && desc !== false) {

@@ -923,5 +930,6 @@ desc = 'generate completion script'

self.showCompletionScript = function ($0) {
argsert('[string]', [$0], arguments.length)
self.showCompletionScript = function ($0, cmd) {
argsert('[string] [string]', [$0, cmd], arguments.length)
$0 = $0 || self.$0
completionCommand = cmd || completionCommand || 'completion'
_logger.log(completion.generateCompletionScript($0, completionCommand))

@@ -1034,3 +1042,3 @@ return self

if (pkgConfig) {
console.warn('Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.')
console.warn('Configuring yargs through package.json is deprecated and will be removed in a future major release, please use the JS API instead.')
options.configuration = Object.assign({}, pkgConfig, options.configuration)

@@ -1037,0 +1045,0 @@ }

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc