Class: Libis::Format::Cli::SubCommand

Inherits:
Thor
  • Object
show all
Includes:
PromptHelper
Defined in:
lib/libis/format/cli/sub_command.rb

Direct Known Subclasses

Convert, Format

Instance Attribute Summary

Attributes included from PromptHelper

#pastel, #prompt

Class Method Summary collapse

Methods included from PromptHelper

#initialize

Class Method Details



11
12
13
# File 'lib/libis/format/cli/sub_command.rb', line 11

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

.subcommand_prefixObject



15
16
17
# File 'lib/libis/format/cli/sub_command.rb', line 15

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