awesome-repositories.com
博客
awesome-repositories.com

通过 AI 驱动的搜索,发现最优秀的开源仓库。

探索精选搜索开源替代品自托管软件博客网站地图
项目关于排名机制媒体报道MCP 服务器
法律隐私政策服务条款
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
yargs avatar

yargs/yargs

0
View on GitHub↗
11,492 星标·1,024 分支·JavaScript·MIT·6 次浏览yargs.js.org↗

Yargs

yargs is a command-line interface framework and argument parser for Node.js. It translates raw command-line strings into structured JavaScript objects, providing a toolkit for building terminal applications with nested sub-commands, dedicated handlers, and a structured user interface.

The framework distinguishes itself through automated help text generation, which constructs formatted usage menus and instructions based on registered metadata. It also provides shell completion generation for Bash and Zsh and uses string-distance algorithms to offer typo correction suggestions when invalid input is detected.

The project covers a broad capability surface including input validation and coercion to enforce argument requirements, as well as a middleware pipeline for intercepting and transforming arguments before execution. It further supports configuration management by merging values from environment variables and configuration files with command-line flags.

Features

  • Argument Parsing - Translates raw command-line strings into structured JavaScript objects with support for types and aliases.
  • CLI Command Frameworks - Provides a comprehensive framework for defining extensible command-line interfaces with asynchronous handler support.
  • Argument Parsers - Parses command-line arguments and flags into structured JavaScript objects for Node.js applications.
  • Argument Aliasing - Maps multiple flags to a single canonical key so that updates to one propagate to all associated aliases.
  • CLI Command Registrars - Maps specific command-line keywords to handler functions to execute distinct application logic.
  • Command Aliasing - Assigns multiple keywords to a single command so any defined alias triggers the same application logic.
  • Nested Command Structures - Enables the creation of nested sub-commands with dedicated handlers and options to organize complex CLI structures.
  • CLI Argument Definitions - Configures command-line arguments with fallback default values to ensure the application functions when flags are omitted.
  • Positional Argument Configurations - Provides mechanisms to define expected positional arguments and handle variadic inputs during command execution.
  • Positional Argument Mappings - Maps keywords to handler functions while supporting optional, required, and variadic positional arguments.
  • Command-Line Argument Parsers - Translates raw command-line strings into structured JavaScript objects supporting various data types.
  • Command Line Documentation - Automatically generates formatted help menus and usage instructions based on the defined command structure.
  • Command Line Interface Frameworks - Provides a comprehensive toolkit for building professional terminal applications with nested commands and dedicated handlers.
  • CLI Option Mappers - Provides mechanisms for mapping function parameters to optional command-line flags, aliases, and default values.
  • Help Text Generators - Automatically constructs and formats detailed usage instructions and help menus based on command metadata.
  • CLI Argument Validators - Enforces the presence of required arguments and displays custom error messages when they are missing.
  • Command Line Interface Design - Provides a framework for designing structured terminal applications with sub-commands, flags, and positional arguments.
  • CLI Input Coercion - Checks for required arguments and coerces input values into specific formats before program execution.
  • Raw Argument Capture - Stops flag parsing at a specific delimiter and captures all remaining input as a list of raw strings.
  • Argument Type Inference - Automatically maps command-line options to specific types using defined types, default values, and restricted choice lists.
  • Environment Variable Configuration - Implements logic to read and use environment variables as fallback values for command-line options.
  • Modular Command Structures - Supports importing command definitions, builders, and handlers from external modules to organize complex CLI hierarchies.
  • Configuration Inheritance - Enables hierarchical configuration by loading base settings from external files or modules and applying overrides.
  • Execution Middleware - Executes synchronous or asynchronous middleware functions before command handlers for shared tasks like setup.
  • Configuration Merging Utilities - Merges configuration settings from environment variables, config files, and command-line flags into a single object.
  • Shell Completion - Generates Bash and Zsh scripts to enable tab-completion for commands and options in the terminal.
  • Shell Completion Generators - Generates platform-specific auto-completion scripts for Bash and Zsh based on the defined command tree.
  • Input Behavior Configurations - Allows customization of parsing behaviors, including camel-case expansion, dot-notation, and boolean negation.
  • Command-Line Correction Engines - Recommends the correct command or option when a typo is detected using string distance calculations.
  • Configuration File Loading - Provides the ability to load and parse structured configuration files such as JSON or JS to supplement command-line arguments.
  • File-Based Configuration Loaders - Merges settings from JSON or JS files with command-line arguments and environment variables.
  • Middleware Pipelines - Provides a pipeline of interceptor functions to transform or validate parsed arguments before command execution.
  • Argument Interception Pipelines - Runs a stack of functions to transform, validate, or overwrite parsed arguments before execution.
  • Conflicting Argument Restrictions - Prevents specific combinations of arguments from being used together to avoid invalid configurations.
  • Typo Correction Suggestions - Recommends the closest matching command when a typo is detected using Levenshtein or similar distance algorithms.
  • Type Coercion Utilities - Coerces raw string arguments into specific data types like booleans, numbers, or arrays based on definitions.
  • CLI Input Strictness - Includes a strict mode to reject unknown options and require valid commands to prevent user errors.
  • CLI Frameworks - Interactive CLI tool collection.
  • 命令行界面 - Parser for command-line arguments with automatic UI generation.
  • Command Line Tools - The modern, pirate-themed successor to optimist.
  • JavaScript CLI Frameworks - Library for parsing arguments and generating interfaces.

Star 历史

yargs/yargs 的 Star 历史图表yargs/yargs 的 Star 历史图表

AI 搜索

探索更多 awesome 仓库

用简单的语言描述您的需求 —— AI 将根据相关性为您从数千个精选开源项目中进行排序。

Start searching with AI

Yargs 的开源替代方案

相似的开源项目,按与 Yargs 的功能重合度排序。
  • fastapi/typerfastapi 的头像

    fastapi/typer

    19,632在 GitHub 上查看↗

    This project is a Python framework for building command-line interfaces by converting standard functions into executable programs. It uses type hints to automatically infer and generate argument parsers, validation logic, and help documentation, allowing developers to define complex terminal applications through simple function signatures. The framework distinguishes itself through a decorator-driven registration system that enables the construction of hierarchical command trees. It supports dependency injection to manage shared state and runtime configuration across subcommands, and it utili

    Pythoncliclickpython
    在 GitHub 上查看↗19,632
  • clap-rs/clapclap-rs 的头像

    clap-rs/clap

    16,528在 GitHub 上查看↗

    Clap is a command-line argument parser for Rust that enables developers to define complex interfaces through strongly-typed data structures. It functions as a comprehensive framework for building terminal applications, automating the transformation of raw string inputs into validated, type-safe code representations while simultaneously generating help documentation and usage statements. The library distinguishes itself by offering both a declarative, attribute-based approach and a fluent builder-pattern API, allowing for flexible interface construction. It includes a sophisticated validation

    Rustargument-parserargument-parsingcommand-line
    在 GitHub 上查看↗16,528
  • urfave/cliurfave 的头像

    urfave/cli

    24,133在 GitHub 上查看↗

    This is a framework for building structured terminal applications in Go. It provides the core components necessary to define a command-line interface, including a system for managing commands, sub-commands, and their associated flags. The library distinguishes itself through an automated help generator that produces formatted usage instructions and manual pages, and a shell completion generator that creates tab-completion scripts for Bash, Zsh, Fish, and PowerShell. It also features a command lifecycle manager to handle pre- and post-execution logic and process exit codes. The toolkit covers

    Goclicommand-linego
    在 GitHub 上查看↗24,133
  • oclif/oclifoclif 的头像

    oclif/oclif

    9,543在 GitHub 上查看↗

    oclif is a Node.js framework for building command-line interfaces. It provides a structured system for developing terminal applications with consistent command patterns, argument parsing, and automated help generation. The project features a modular plugin architecture that allows for external functionality to be injected via a manifest-based loading mechanism. It includes a dedicated distribution pipeline and packager to bundle applications into OS-native installers and tarballs for Windows, macOS, and Linux. The framework covers a broad range of development capabilities, including project

    TypeScript
    在 GitHub 上查看↗9,543
查看 Yargs 的所有 30 个替代方案→

常见问题解答

yargs/yargs 是做什么的?

yargs is a command-line interface framework and argument parser for Node.js. It translates raw command-line strings into structured JavaScript objects, providing a toolkit for building terminal applications with nested sub-commands, dedicated handlers, and a structured user interface.

yargs/yargs 的主要功能有哪些?

yargs/yargs 的主要功能包括:Argument Parsing, CLI Command Frameworks, Argument Parsers, Argument Aliasing, CLI Command Registrars, Command Aliasing, Nested Command Structures, CLI Argument Definitions。

yargs/yargs 有哪些开源替代品?

yargs/yargs 的开源替代品包括: fastapi/typer — This project is a Python framework for building command-line interfaces by converting standard functions into… clap-rs/clap — Clap is a command-line argument parser for Rust that enables developers to define complex interfaces through… urfave/cli — This is a framework for building structured terminal applications in Go. It provides the core components necessary to… oclif/oclif — oclif is a Node.js framework for building command-line interfaces. It provides a structured system for developing… pallets/click — Click is a Python framework for building command-line interfaces. It provides a declarative approach to defining… cliutils/cli11 — CLI11 is a header-only C++ library for parsing command line arguments and managing configuration files. It maps shell…