Class: Gzr::Commands::SubCommandBase

Inherits:
Thor
  • Object
show all
Defined in:
lib/gzr/commands/subcommandbase.rb

Direct Known Subclasses

Connection, Dashboard, Group, Look, Model, Plan, Query, Space, User

Class Method Summary collapse

Class Method Details

Workaround so that help displays the right name base on this link github.com/erikhuda/thor/issues/261#issuecomment-69327685



32
33
34
# File 'lib/gzr/commands/subcommandbase.rb', line 32

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

.subcommand_prefixObject



36
37
38
# File 'lib/gzr/commands/subcommandbase.rb', line 36

def self.subcommand_prefix
  self.name.gsub(%r{.*::}, '').gsub(%r{^[A-Z]}) { |match| match[0].downcase }.gsub(%r{[A-Z]}) { |match| "-#{match[0].downcase}" }
end