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 11.0.0 to 11.1.0

8

lib/apply-extends.js

@@ -9,5 +9,5 @@

function checkForCircularExtends (path) {
if (previouslyVisitedConfigs.indexOf(path) > -1) {
throw new YError(`Circular extended configurations: '${path}'.`)
function checkForCircularExtends (cfgPath) {
if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
throw new YError(`Circular extended configurations: '${cfgPath}'.`)
}

@@ -25,3 +25,3 @@ }

if (typeof config.extends !== 'string') return defaultConfig
const isPath = /\.json$/.test(config.extends)
const isPath = /\.json|\..*rc$/.test(config.extends)
let pathToDefault = null

@@ -28,0 +28,0 @@ if (!isPath) {

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

const options = yargs.getOptions()
let keys = Object.keys(
Object.keys(descriptions)
.concat(Object.keys(demandedOptions))
.concat(Object.keys(demandedCommands))
.concat(Object.keys(options.default))
.reduce((acc, key) => {
if (key !== '_') acc[key] = true
return acc
}, {})
)
let keys = []
keys = keys.concat(Object.keys(descriptions))
keys = keys.concat(Object.keys(demandedOptions))
keys = keys.concat(Object.keys(demandedCommands))
keys = keys.concat(Object.keys(options.default))
keys = keys.filter(key => {
if (options.hiddenOptions.indexOf(key) < 0) {
return true
} else if (yargs.parsed.argv[options.showHiddenOpt]) {
return true
}
})
keys = Object.keys(keys.reduce((acc, key) => {
if (key !== '_') acc[key] = true
return acc
}, {}))
const theWrap = getWrap()

@@ -168,0 +175,0 @@ const ui = require('cliui')({

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

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

"cpr": "^2.0.0",
"cross-spawn": "^5.0.1",
"cross-spawn": "^6.0.4",
"es6-promise": "^4.0.2",

@@ -36,0 +36,0 @@ "hashish": "0.0.4",

@@ -1,2 +0,9 @@

# Yargs
<p align="center">
<img width="250" src="/yargs-logo.png">
</p>
<h1 align="center"> Yargs </h1>
<p align="center">
<b >Yargs be a node.js library fer hearties tryin' ter parse optstrings</b>
</p>
<br>

@@ -11,10 +18,7 @@ [![Build Status][travis-image]][travis-url]

_Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com)_.
## Description :
Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
> Yargs be a node.js library fer hearties tryin' ter parse optstrings.
It gives you:
<img width="250" src="/yargs-logo.png">
Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface. It gives you:
* commands and (grouped) options (`my-program.js serve --port=5000`).

@@ -34,4 +38,6 @@ * a dynamically generated help menu based on your arguments.

## Simple Example
## Usage :
### Simple Example
````javascript

@@ -56,5 +62,5 @@ #!/usr/bin/env node

## Complex Example
### Complex Example
```js
```javascript
#!/usr/bin/env node

@@ -81,4 +87,10 @@ require('yargs') // eslint-disable-line

## Table of Contents
## Community :
Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com).
## Documentation :
### Table of Contents
* [Yargs' API](/docs/api.md)

@@ -85,0 +97,0 @@ * [Examples](/docs/examples.md)

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

'array', 'boolean', 'string', 'skipValidation',
'count', 'normalize', 'number'
'count', 'normalize', 'number',
'hiddenOptions'
]

@@ -480,4 +481,4 @@

self.pkgConf = function pkgConf (key, path) {
argsert('<string> [string]', [key, path], arguments.length)
self.pkgConf = function pkgConf (key, rootPath) {
argsert('<string> [string]', [key, rootPath], arguments.length)
let conf = null

@@ -487,7 +488,7 @@ // prefer cwd to require-main-filename in this method

// rather than "yargs" config in nyc (where nyc is the main filename)
const obj = pkgUp(path || cwd)
const obj = pkgUp(rootPath || cwd)
// If an object exists in the key, add it to options.configObjects
if (obj[key] && typeof obj[key] === 'object') {
conf = applyExtends(obj[key], path || cwd)
conf = applyExtends(obj[key], rootPath || cwd)
options.configObjects = (options.configObjects || []).concat(conf)

@@ -500,4 +501,4 @@ }

const pkgs = {}
function pkgUp (path) {
const npath = path || '*'
function pkgUp (rootPath) {
const npath = rootPath || '*'
if (pkgs[npath]) return pkgs[npath]

@@ -508,5 +509,13 @@ const findUp = require('find-up')

try {
let startDir = rootPath || require('require-main-filename')(parentRequire || require)
// When called in an environment that lacks require.main.filename, such as a jest test runner,
// startDir is already process.cwd(), and should not be shortened.
// Whether or not it is _actually_ a directory (e.g., extensionless bin) is irrelevant, find-up handles it.
if (!rootPath && path.extname(startDir)) {
startDir = path.dirname(startDir)
}
const pkgJsonPath = findUp.sync('package.json', {
cwd: path || require('path').dirname(require('require-main-filename')(parentRequire || require)),
normalize: false
cwd: startDir
})

@@ -657,4 +666,5 @@ obj = JSON.parse(fs.readFileSync(pkgJsonPath))

const desc = opt.describe || opt.description || opt.desc
if (!opt.hidden) {
self.describe(key, desc)
self.describe(key, desc)
if (opt.hidden) {
self.hide(key)
}

@@ -825,2 +835,24 @@

const defaultShowHiddenOpt = 'show-hidden'
options.showHiddenOpt = defaultShowHiddenOpt
self.addShowHiddenOpt = self.showHidden = function addShowHiddenOpt (opt, msg) {
argsert('[string|boolean] [string]', [opt, msg], arguments.length)
if (arguments.length === 1) {
if (opt === false) return self
}
const showHiddenOpt = typeof opt === 'string' ? opt : defaultShowHiddenOpt
self.boolean(showHiddenOpt)
self.describe(showHiddenOpt, msg || usage.deferY18nLookup('Show hidden options'))
options.showHiddenOpt = showHiddenOpt
return self
}
self.hide = function hide (key) {
argsert('<string|object>', [key], arguments.length)
options.hiddenOptions.push(key)
return self
}
self.showHelpOnFail = function showHelpOnFail (enabled, message) {

@@ -827,0 +859,0 @@ argsert('[boolean|string] [string]', [enabled, message], arguments.length)

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