https://github.com/omgreenfield/omg-thor-ext
A gemified version of Matt Brictson's extension to allow Thor CLIs to behave in ways we've come to expect from other CLIs
https://github.com/omgreenfield/omg-thor-ext
ruby thor
Last synced: about 1 year ago
JSON representation
A gemified version of Matt Brictson's extension to allow Thor CLIs to behave in ways we've come to expect from other CLIs
- Host: GitHub
- URL: https://github.com/omgreenfield/omg-thor-ext
- Owner: omgreenfield
- Created: 2024-08-09T17:56:38.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-12T22:06:19.000Z (almost 2 years ago)
- Last Synced: 2025-03-22T21:48:48.750Z (over 1 year ago)
- Topics: ruby, thor
- Language: Ruby
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Thor extension
[Matt Brictson](https://github.com/mattbrictson) had the [same complaints](https://mattbrictson.com/blog/fixing-thor-cli-behavior) I did about [Thor](https://github.com/rails/thor). Well, he went and fixed them all, I put them into a gem and now use it in many of my Thor CLIs.
## Original source
https://github.com/mattbrictson/gem/blob/main/lib/example/thor_ext.rb
## What it does
Overwrites a few Thor methods so that it behaves more like a typical CLI:
- Accepts `-h` or `--help` to show help
- Treats unrecognized options as errors instead of ignoring them
- Prints error to `stderr` in red with no stacktrace
- Prints full stacktrace when setting `VERBOSE` environment variable
- Exists with a non-zero status on error
## Installation
```sh
gem i thor-ext
```
```ruby
gem 'thor-ext'
```
## Usage
In your Thor CLI:
```ruby
class SuperAwesomeCli < Thor
extend ThorExt::Start
end
```