Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Slightly more sensible error when no args required

Replaces errors such as:
`<command> requires at least 0 argument: "<command>"`
with:
`<command> should have no arguments: "<command>"`
  • Loading branch information...
commit 8e0c8c97c3713f8eca35858d014224063d6f377d 1 parent bdf13cb
Ross Duggan authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/thor/base.rb
View
8 lib/thor/base.rb
@@ -471,8 +471,12 @@ def handle_argument_error(task, error, arity=nil) #:nodoc:
msg = "#{basename} #{task.name}"
if arity
required = arity < 0 ? (-1 - arity) : arity
- msg << " requires at least #{required} argument"
- msg << "s" if required > 1
+ if required == 0
+ msg << " should have no arguments"
+ else
+ msg << " requires at least #{required} argument"
+ msg << "s" if required > 1
+ end
else
msg = "call #{msg} as"
end
Please sign in to comment.
Something went wrong with that request. Please try again.