4

a framework for building node.js cli programs · rotini

 2 years ago
source link: https://matthewgetz.github.io/rotini/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
rotini

a framework for building node.js cli programs

Write your CLI as config not as code.

Features

Declarative Program Definitions

Define and describe your program commands, arguments, and flags. rotini will build your program and parse it; you only need to write code for your command operations.

Command, Argument, and Flag Parsing

rotini has a powerful and flexible parser. User input is checked against the program definition you write, and command operations are handed all parsed commands, arguments, and flags.

Subcommand Support

Nest commands under commands under commands under commands... Every command you define can have its own subcommands, bringing a declarative approach to program definitions.

Command Aliases

In the event that you need to deprecate a command or want to move to a better suited command name, you can supply an alias for the command that the parser will match to your command during parsing. Each command can have multiple aliases to reduce breaking changes and to help with naming migrations.

Command Force Prompting

rotini will prompt users to confirm (Y/n) commands that have a "force" flag defined in their definition, which can be helpful as a guard against destructive actions. The prompt can be bypassed if the user passes the override flag, which may also be needed in CI environments.

Value Validation

rotini argument and flag definitions can specify a type, which the parser will respect; mismatched value types passed to your program will report errors. Additionally, arguments and flags can have defined allowed values and are each provided with a callback for you to write additional validation for your argument and flag parsing.

Auto-Generated Help Output

Program and Command help output is built from the definition you provide to rotini. When a help flag is passed or when a command syntax is incorrect, rotini will output the corresponding help.

Ship Faster

rotini is a highly-opinionated framework that allows you to focus on your program code without needing to manage how your program is built or parsed. Add new commands quickly, deploy new functionality faster.

Configuration File Support

rotini returns helper functions for writing and reading a configuration file (JSON/txt) for your program when a configuration directory and file defined in the program definition.


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK