lib/cl/cmd.rb in cl-1.2.1 vs lib/cl/cmd.rb in cl-1.2.2
- old
+ new
@@ -1,12 +1,15 @@
require 'registry'
+require 'cl'
require 'cl/args'
require 'cl/dsl'
require 'cl/opts'
require 'cl/parser'
class Cl
+ singleton_class.send(:attr_accessor, :auto_register) # remove unless anyone needs this
+
# Base class for all command classes that can be run.
#
# Inherit your command classes from this class, use the {Cl::Cmd::Dsl} to
# declare arguments, options, summary, description, examples etc., and
# implement the method #run.
@@ -18,9 +21,10 @@
class << self
include Merge, Suggest, Underscore
inherited = ->(const) do
+ return unless Cl.auto_register
if const.name
key = underscore(const.name.split('::').last)
key = [registry_key, key].compact.join(':') unless abstract?
const.register(key)
end