Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 19, 2024 via pnpm

yargs 16.2.0

yargs the modern, pirate-themed, successor to optimist.
Package summary
Share
0
issues
2
licenses
12
MIT
4
ISC
Package created
23 Nov 2013
Version published
5 Dec 2020
Maintainers
2
Total deps
16
Direct deps
7
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
12 Packages, Including:
ansi-regex@5.0.1
ansi-styles@4.3.0
color-convert@2.0.1
color-name@1.1.4
emoji-regex@8.0.0
escalade@3.1.2
is-fullwidth-code-point@3.0.0
require-directory@2.1.1
string-width@4.2.3
strip-ansi@6.0.1
wrap-ansi@7.0.0
yargs@16.2.0

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
4 Packages, Including:
cliui@7.0.4
get-caller-file@2.0.5
y18n@5.0.8
yargs-parser@20.2.9
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

7
All Dependencies CSV
β“˜ This is a list of yargs 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
cliui7.0.47.24 kBISC
prod
escalade3.1.24.25 kBMIT
prod
get-caller-file2.0.52.33 kBISC
prod
require-directory2.1.14.27 kBMIT
prod
string-width4.2.32.33 kBMIT
prod
y18n5.0.86.01 kBISC
prod
yargs-parser20.2.926.98 kBISC
prod

Visualizations

Frequently Asked Questions

What does yargs do?

Yargs is a stunning Node.js library that aids in building futuristic, highly-interactive command line tools. By parsing arguments and rendering a user-friendly interface, Yargs brings to the table an array of features to simplify command line syntax. Yargs assists in handling commands and grouped options, creating dynamic help menus, delivering bash-completion shortcuts for commands and options, and much more.

How do you use yargs?

Using Yargs involves implementing it within your Node.js applications. Here is a simple usage example:

#!/usr/bin/env node
const yargs = require('yargs/yargs')
const { hideBin } = require('yargs/helpers')
const argv = yargs(hideBin(process.argv)).argv

if (argv.ships > 3 && argv.distance < 53.5) {
  console.log('Plunder more riffiwobbles!')
} else {
  console.log('Retreat from the xupptumblers!')
}

In the above code, Yargs is imported and its 'hideBin' function is used to handle the process arguments array. The 'argv' object is then used to access the command line arguments.

Here is a more detailed example:

#!/usr/bin/env node
const yargs = require('yargs/yargs')
const { hideBin } = require('yargs/helpers')

yargs(hideBin(process.argv))
  .command('serve [port]', 'start the server', (yargs) => {
    return yargs
      .positional('port', {
        describe: 'port to bind on',
        default: 5000
      })
  }, (argv) => {
    if (argv.verbose) console.info(`start server on :${argv.port}`)
    serve(argv.port)
  })
  .option('verbose', {
    alias: 'v',
    type: 'boolean',
    description: 'Run with verbose logging'
  })
  .parse()

In this more intricate example, a command is defined using the 'command' function, a 'verbose' option is added with the 'option' function, and 'parse' is used to parse the arguments.

Where are the yargs docs?

Yargs' comprehensive documentation can be found by visiting the 'Yargs' API on the GitHub repository page. The documentation offers in-depth insight into Yargs' workings through a systematic table of contents. This resource comes packed with examples, parsing tricks, advanced topics, and tips for contributing to the project. For those looking to delve deeper into the exciting world of Yargs, the repository's 'docs' directory holds a wealth of information.