16.2.0 • Published 10 days ago

yargs v16.2.0

Weekly downloads
49,510,428
License
MIT
Repository
github
Last release
10 days ago

Build Status Coverage Status NPM version Windows Tests js-standard-style Conventional Commits Slack

Description :

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).
  • a dynamically generated help menu based on your arguments.
  • bash-completion shortcuts for commands and options.
  • and tons more.

Installation

npm i yargs --save

Usage :

Simple Example

#!/usr/bin/env node
const argv = require('yargs').argv

if (argv.ships > 3 && argv.distance < 53.5) {
  console.log('Plunder more riffiwobbles!')
} else {
  console.log('Retreat from the xupptumblers!')
}
$ ./plunder.js --ships=4 --distance=22
Plunder more riffiwobbles!

$ ./plunder.js --ships 12 --distance 98.7
Retreat from the xupptumblers!

Complex Example

#!/usr/bin/env node
require('yargs') // eslint-disable-line
  .command('serve [port]', 'start the server', (yargs) => {
    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',
    default: false
  })
  .argv

Run the example above with --help to see the help for the application.

Community :

Having problems? want to contribute? join our community slack.

Documentation :

Table of Contents

jest-runtimejest-cliwebpack-dev-servermochasass-graph@grpc/proto-loadercli-highlightconcurrentlykarmanyc@angular/compiler-cligulp-cliprotractorsaucelabs@care-for/yargs-unparser@tool3/any.clitest__213pino-slackdbtinypng@finitydevs/create-sdf-netsuitenode-gamelift@derogab/shitchecker-toolurltestsaidbekakagasquareboytnc-cup@liuhaomin/testomniport-cli@asep.setiawan/react-kitmypen@boris47/electron-webpack@iharob/graphql-mesh-cli@kaishuu0123/oas-resolver@kaishuu0123/swagger2openapiarno-front-clireact-native-bluetooth2killi8n-react-native-fast-imagemodularize-componentsb-filmothequesb-collection-filesqldumpnodewebx-buildeditorconfig-lint-jsgenlicenselicensar@augustojosedev/univerteocw-to-hugonest-aws-serverless-toolswsx-cli@leading-works/create-trans-unit@nia3208/foreversuremdm@httptoolkit/win-detect-browsersgrav-plugin-webpackergulpproject-v1transcendhetatestkoa-templateynab-file-importercovid-by-countrywelsee-cliwebpack-modify-nginx-plugin-test@aeppic/install-image-servernode-red-contrib-auth-motebus@open-template-hub/open-template-hub-server-generatorschriftlage-cliplaytwo-core-cms-sectionsmongo-backup-minionodejs-intership-wh1tevsz3r-runner@tradeling/gen-sdk@corratech/pwa-buildpack@yelloan/redoc-clietherless-cli@enlibe/clipuppeteer-clientoapi2ts3asenkronvehttprequestgraphql-schema-processgraphql-monsterelectron-zero@binaryshrub/arbor-cli@byte-ferry/cli@kroonprins/pipectl-coreflowmms@yeeti/automatypeorm-model-generator-relations-republishjuit-api-schemaspring-generatorxen-hostctl-builder@tuxmachine/html2json@lucat1/linaria@puzzleio-devops/env-file-generator@puzzleio-devops/env-token-replacer@canvanauts/check-a-block@bigpopakap/architectsongrunyu112@w00zla/npm-recursersm-flex-ns
16.2.0

2 months ago

16.1.1

2 months ago

16.1.0

3 months ago

16.0.4-candidate.0

4 months ago

16.0.2

4 months ago

16.0.1

4 months ago

16.0.3

4 months ago

16.0.0

4 months ago

16.0.0-beta.3

4 months ago

16.0.0-beta.2

4 months ago

16.0.0-beta.1

5 months ago

16.0.0-beta.0

5 months ago

16.0.0-alpha.3

5 months ago

16.0.0-alpha.0

5 months ago

16.0.0-alpha.1

5 months ago

16.0.0-alpha.2

5 months ago

15.4.1

6 months ago

15.4.0

7 months ago

15.4.0-beta.1

7 months ago

7.1.1

8 months ago

15.4.0-beta.0

8 months ago

15.3.2-beta.0

9 months ago

15.3.1

10 months ago

13.3.2

10 months ago

14.2.3

10 months ago

15.3.1-beta.0

10 months ago

15.3.0

11 months ago

15.3.0-beta.1

11 months ago

15.3.0-beta.0

11 months ago

15.2.0-beta.2

11 months ago

15.2.0

11 months ago

15.2.0-beta.1

11 months ago

15.2.0-beta.0

11 months ago

15.1.0

1 year ago

14.2.2

1 year ago

15.0.2

1 year ago

15.0.1

1 year ago

15.0.0

1 year ago

14.2.1

1 year ago

11.1.1

1 year ago

14.2.0

1 year ago

14.1.0

1 year ago

14.0.0

1 year ago

13.3.0

2 years ago

13.2.4

2 years ago

13.2.2

2 years ago

13.2.1

2 years ago

13.2.0

2 years ago

13.1.0

2 years ago

12.0.5

2 years ago

12.0.4

2 years ago

12.0.2

2 years ago

12.0.1

3 years ago

12.0.0

3 years ago

11.1.0

3 years ago

11.0.0

3 years ago

10.1.2

3 years ago

10.1.1

3 years ago

10.1.0

3 years ago

10.0.3

3 years ago

10.0.2

3 years ago

10.0.1

3 years ago

10.0.0

3 years ago

10.0.0-alpha.4

3 years ago

10.0.0-alpha.3

3 years ago

10.0.0-alpha.2

3 years ago

10.0.0-alpha.1

3 years ago

10.0.0-alpha.0

3 years ago

9.0.1

3 years ago

9.0.0

3 years ago

8.0.2

4 years ago

8.0.1

4 years ago

8.0.0

4 years ago

7.1.0

4 years ago

7.0.2

4 years ago

7.0.1

4 years ago

7.0.0

4 years ago

7.0.0-alpha.3

4 years ago

7.0.0-alpha.2

4 years ago

7.0.0-alpha.1

4 years ago

6.6.0

4 years ago

6.5.0

4 years ago

6.4.0

4 years ago

6.3.0

4 years ago

6.3.0-candidate

4 years ago

6.2.0

4 years ago

6.2.0-candidate

4 years ago

6.1.1

4 years ago

6.1.1-candidate

4 years ago

6.1.0-candidate

4 years ago

6.0.0

4 years ago

6.0.0-alpha.1

4 years ago

5.0.0

4 years ago

5.0.0-candidate

4 years ago

4.8.1

5 years ago

4.8.1-candidate

5 years ago

4.8.0

5 years ago

4.8.0-candidate3

5 years ago

4.8.0-candidate2

5 years ago

4.8.0-candidate

5 years ago

4.7.1

5 years ago

4.7.0

5 years ago

4.7.0-pre

5 years ago

4.6.0

5 years ago

4.6.0-candidate

5 years ago

4.5.0

5 years ago

4.4.0

5 years ago

4.3.2

5 years ago

4.3.1

5 years ago

4.3.0

5 years ago

4.2.0

5 years ago

4.1.0

5 years ago

4.0.0

5 years ago

4.0.0-alpha5

5 years ago

4.0.0-alpha4

5 years ago

4.0.0-alpha3

5 years ago

4.0.0-alpha2

5 years ago

4.0.0-alpha1

5 years ago

3.32.0

5 years ago

3.31.0

5 years ago

3.30.0

5 years ago

3.29.0

5 years ago

3.28.0

5 years ago

3.27.0

5 years ago

3.26.0

5 years ago

3.25.0

5 years ago

3.24.0

5 years ago

3.23.0

5 years ago

3.22.2

5 years ago

3.22.1

5 years ago

3.22.0

5 years ago

3.21.1

5 years ago

3.21.0

5 years ago

3.20.0

5 years ago

3.19.0

5 years ago

3.18.1

5 years ago

3.18.0

5 years ago

3.17.1

5 years ago

3.16.1

5 years ago

3.16.0

5 years ago

3.15.0

6 years ago

3.14.0

6 years ago

3.13.0

6 years ago

3.12.0

6 years ago

3.11.0

6 years ago

3.10.0

6 years ago

3.9.1

6 years ago

3.9.0

6 years ago

3.8.0

6 years ago

3.7.2

6 years ago

3.7.1

6 years ago

3.7.0

6 years ago

3.6.0

6 years ago

3.5.4

6 years ago

3.5.3

6 years ago

3.5.2

6 years ago

3.5.1

6 years ago

3.5.0

6 years ago

3.4.5

6 years ago

3.4.4

6 years ago

3.4.0

6 years ago

3.3.1

6 years ago

3.2.1

6 years ago

3.1.0

6 years ago

3.0.4

6 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.3.0

6 years ago

2.1.1

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.6

7 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.15

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago