Module: Thor::CreateCommandOverride

Included in:
Thor
Defined in:
lib/jets/thor/base.rb

Instance Method Summary collapse

Instance Method Details

#create_command(meth) ⇒ Object

:nodoc:



35
36
37
38
# File 'lib/jets/thor/base.rb', line 35

def create_command(meth) # :nodoc:
  @long_desc ||= long_desc_from_help_file(self, meth)
  super
end

#long_desc_from_help_file(klass, meth) ⇒ Object

So we don’t have to duplicate the long_desc Thor CLI classes



41
42
43
44
45
46
47
48
# File 'lib/jets/thor/base.rb', line 41

def long_desc_from_help_file(klass, meth)
  folder = klass.name.demodulize.underscore unless klass == Jets::CLI
  path = ["../cli/help", folder, "#{meth}.md"].compact.join("/")
  path = File.expand_path(path, __dir__)
  if File.exist?(path)
    IO.read(path)
  end
end