lib/cl/cmd.rb in cl-0.1.2 vs lib/cl/cmd.rb in cl-0.1.3
- old
+ new
@@ -23,11 +23,11 @@
end
def parse(ctx, args)
opts = Parser.new(self.opts, args).opts unless self == Help
opts = merge(ctx.config[registry_key], opts) if ctx.config[registry_key]
- [args, opts]
+ [args, opts || {}]
end
def abstract
unregister
end
@@ -79,11 +79,11 @@
attr_reader :ctx, :args
def initialize(ctx, args)
args, opts = self.class.parse(ctx, args)
@ctx = ctx
- @opts = self.class.opts.apply(self, self.opts.merge(opts || {}))
- @args = @opts[:help] ? args : self.class.args.apply(self, args)
+ @opts = self.class.opts.apply(self, self.opts.merge(opts))
+ @args = self.class.args.apply(self, args, opts)
end
def opts
@opts ||= {}
end