Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Thor extension

Matt Brictson had the same complaints I did about 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

gem i thor-ext
gem 'thor-ext'

Usage

In your Thor CLI:

class SuperAwesomeCli < Thor
  extend ThorExt::Start
end

About

A gemified version of Matt Brictson's extension to allow Thor CLIs to behave in ways we've come to expect from other CLIs

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages