lib/hanami/cli_base.rb in hanami-0.9.2 vs lib/hanami/cli_base.rb in hanami-1.0.0.beta1
- old
+ new
@@ -25,7 +25,22 @@
# end
# end
def define_commands(&blk)
class_eval(&blk) if block_given?
end
+
+ def banner(command, nspace = true, subcommand = false)
+ super(command, nspace, namespace != 'hanami:cli')
+ end
+
+ def handle_argument_error(command, error, args, arity)
+ name = [(namespace == 'hanami:cli' ? nil : namespace), command.name].compact.join(" ")
+
+ msg = "ERROR: \"#{basename} #{name}\" was called with "
+ msg << "no arguments" if args.empty?
+ msg << "arguments " << args.inspect unless args.empty?
+ msg << "\nUsage: #{banner(command).inspect}"
+
+ raise Thor::InvocationError, msg
+ end
end
end