Class: SubCommandBase

Inherits:
Thor
  • Object
show all
Defined in:
lib/neetob/cli/sub_command_base.rb

Class Method Summary collapse

Class Method Details



6
7
8
# File 'lib/neetob/cli/sub_command_base.rb', line 6

def self.banner(command, namespace = nil, subcommand = false)
  "#{basename} #{subcommand_prefix} #{command.usage}"
end

.subcommand_prefixObject



10
11
12
13
14
15
16
# File 'lib/neetob/cli/sub_command_base.rb', line 10

def self.subcommand_prefix
  self.name
    .split("::")[2..-2]
    .map { |name| name.gsub(%r{^[A-Z]}) { |match| match[0].downcase } }
    .map { |name| name.gsub(%r{[A-Z]}) { |match| "-#{match[0].downcase}" } }
    .join(" ")
end