talira

Parse command-line arguments and build CLIs in Node.js

open sourceMITfree

yargs is a Node.js library for building interactive command-line tools: it parses arguments into commands and grouped options, generates a help menu from them, and writes Bash and Zsh completion scripts for your program. It has TypeScript typings and also runs in the browser. The current version supports Node.js's long-term support releases from 20.19 on. It's the pirate-themed successor to optimist.

Problems it solves

  • parse command-line flags and subcommands in a Node.js script
  • give my Node CLI a generated --help screen
  • add shell tab completion to a Node command-line tool

Features

  • Commands with grouped options
  • Help menu generated from your commands and options
  • Bash and Zsh completion scripts
  • TypeScript typings and browser support

Alternatives

The same job

These do what yargs does.

  1. oclif Salesforce's open CLI framework for building Node.js command-line tools
  2. Commander.js The complete solution for Node.js command-line interfaces
  3. meow Small helper for building Node.js command-line apps
  4. minimist Minimal command-line argument parser for Node.js

Compare yargs with the top 3