I'm new to Thor (and to Ruby) and I'm considering using it within a build script, as it's said it can be a replacement to Rake (thus to Make). However after a short trial, I'm confused about the error status it returns. I quickly went through the wiki but haven't seen any mention about that.
With just the first "Simple Example", test.thor
:
class Test < Thor
desc "example", "an example task"
def example
puts "I'm a thor task!"
end
end
version #:
eruve>thor version
Thor 0.18.1
I tried the following, an erroneous command on purpose:
eruve>ruby --version; thor test:example badarg; echo exit status: $?
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin10.8.0]
ERROR: thor example was called with arguments ["badarg"]
Usage: "thor test:example".
exit status: 0
So, there was an error but it exits with status 0 nonetheless... meaning I'd rather not use it in a (non-ruby) script, or else the script would continue running even though it should terminate. Subsequent errors might be difficult to analyse.
I must be missing something, hence my questions:
Is there an easy way to get a non-zero status by default in case of an error (config file, etc.)?
If not, what am I supposed to do to get it right?
Thank you.