A minimal Ruby framework for building command-line applications with automatic argument parsing and help generation.
Clamp is a Ruby framework for building command-line applications. It automates the parsing of command-line arguments, generates help documentation, and supports subcommands, allowing developers to quickly create robust CLI tools without repetitive boilerplate code.
Ruby developers who need to build command-line utilities, scripts, or multi-command tools and want to avoid manual argument handling and help text generation.
Clamp offers a minimal, class-based DSL that reduces boilerplate while providing advanced features like subcommands, shell completion, and validation, making it a streamlined alternative to heavier CLI libraries.
a Ruby command-line application framework
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Clamp's class-based DSL lets you declare options and parameters with simple methods like 'option' and 'parameter', automatically generating attributes and help text, as shown in the Quick Start example.
It supports generating completion scripts for bash, zsh, and fish shells by requiring 'clamp/completion', enhancing user experience without external dependencies.
Options and parameters can include custom blocks for type conversion and validation, with Clamp catching ArgumentError and providing clear error messages for invalid inputs.
Enables Git-like nested commands where options are inheritable from parent classes, making it easy to build complex CLI hierarchies without code duplication.
Clamp requires options to precede parameters by default, unlike GNU getopt; enabling interspersed parsing needs explicit configuration with Clamp.allow_options_after_parameters = true.
Advanced features like shell completion are not enabled by default and require additional setup, adding complexity for simple scripts or rapid prototyping.
As a minimal framework, it lacks the extensive plugins, community contributions, and integrations found in more established alternatives like Thor, which might limit scalability.