百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
T

tiny-bin

> 开发工具
开源

一个用于构建小巧而美观命令行应用程序的库。

194 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个用于构建小巧而美观命令行应用程序的库。

Tiny Bin

A library for building tiny and beautiful command line apps.

Features

At a high level this package provides:

  • A tiny library, that has no third-party dependencies, that can be bundled, for great startup performance.
  • Beautiful colored and detailed help pages. Colors can be turned off also.
  • Automatic package name and version detection, so you don't even need to provide those.
  • Automatic typo detection, it will suggest the closest command/option if you mistype one.
  • Automatic options type inference from the provided options.
  • Automatic help and --help handling, both for the bin and for each command.
  • Automatic --version and -v handling.
  • Automatic --no-color and --no-colors handling.

This library has 5 primitives -- bins, commands, options, arguments and actions:

  • Bin:
    • A bin is the entry point of your command line app, you can define multiple bins.
    • Each bin has a name, a description, and a few built-in commands (default, help, version).
    • Each bin can have multiple custom commands.
    • The action for the default command is customizable.
  • Command:
    • A command is the function that will be executed when running your bin.
    • Each command has a name, a description, and an automatically generated usage example.
    • Each command can optional have a section, which will be used to group commands in the help page.
    • Each command can optionally be hidden from the help page.
    • Each command can optionally have custom usage examples.
    • Each command can have multiple options.
    • Each command can have multiple arguments.
    • Each command has an action, which is your actual function that will called by the command.
  • Option:
    • An option is a flag that can be passed to your command.
    • Each option has a name, a description, and an implicit type (boolean or string).
    • Each option can optional have a section, which will be used to group options in the help page.
    • Each option can optionally be hidden from the help page.
    • Each option can optionally be marked as deprecated, causing it to be dimmed in the help page.
    • Each option can optionally be marked as eager, so it will consume multiple consecutive values.
    • Each option can optionally be marked as incompatible with some others.
    • Each option can optionally be marked as required, so the library will error if it's not provided.
    • Each option can optionally be marked as explicitly overriding a previously defined option.
    • Each option can optionally have a default value.
    • Each option can optionally have an explicit list of allowed values.
    • Each option can have multiple longhands (e.g. --foo) and multiple shorthands (e.g. -f).
    • Each provided longhand and shorthand for an option is automatically aliased to all the others.
    • Each non-boolean option must receive at least one value.
    • Each variadic option can receive multiple values (e.g. ``).
  • Argument:
    • An argument is a value that can be passed to your command.
    • Each argument has a name and a description.
    • Each argument can be marked as required, so the library will error if it's not provided.
    • Each variadic argument (e.g. ``) can receive multiple values.
  • Action:
    • An action is the function that will be called when running your command.
    • It will receive the following arguments:
      • The options object, containing all options for which the library has a value.
      • The arguments array, containing an array of strings passed to your command.
      • The passthrough arguments array, containing an array of strings passed to your command after the special -- separator.

Install

bash
npm install tiny-bin

Usage

…

License

MIT © Fabio Spampinato

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptappbinclicommand

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类开发工具
定价开源

> 相关工具

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具