lib/cl/cmd.rb in cl-1.1.3 vs lib/cl/cmd.rb in cl-1.1.4
- old
+ new
@@ -18,11 +18,15 @@
class << self
include Merge, Suggest, Underscore
inherited = ->(const) do
- const.register [registry_key, underscore(const.name.split('::').last)].compact.join(':') if const.name
+ if const.name
+ key = underscore(const.name.split('::').last)
+ key = [registry_key, key].compact.join(':') unless abstract?
+ end
+ const.register key
const.define_singleton_method(:inherited, &inherited)
end
define_method(:inherited, &inherited)
def cmds
@@ -38,9 +42,11 @@
def suggestions(opt)
suggest(opts.map(&:name), opt.sub(/^--/, ''))
end
end
+
+ abstract
opt '--help', 'Get help on this command'
attr_reader :ctx, :args