A zero-dependency Ruby CLI boilerplate class (with boilerplate tests)
Have you ever wanted to add a simple CLI to one of your small Ruby libraries, but did not want to add the dependency for thor or some other CLI library/framework? Well now you can copy this boilerplate code for a zero-dependency Ruby CLI class! Features include:
- Zero-dependencies, making it ideal for adding a CLI to small libraries.
- Correctly handles
Ctrl^C
and broken pipe exceptions (aka$ your-cli | head
). - Catches any other exceptions and prints a bug report.
- Defines the CLI as a class, making it easy to test.
- Comes with boilerplate RSpec tests.
Post a comment