class Chronicle::ETL::CLI::SubcommandBase
Base class for CLI
subcommands. Overrides Thor methods so we can use command:subcommand syntax
Public Class Methods
help(shell, subcommand = false)
click to toggle source
Print usage instructions for a subcommand
# File lib/chronicle/etl/cli/subcommand_base.rb, line 7 def self.help(shell, subcommand = false) list = printable_commands(true, subcommand) Thor::Util.thor_classes_in(self).each do |klass| list += klass.printable_commands(false) end list.sort! { |a, b| a[0] <=> b[0] } shell.say "COMMANDS".bold shell.print_table(list, indent: 2, truncate: true) shell.say class_options_help(shell) end
subcommand_prefix()
click to toggle source
Use subcommand classname to derive display name for subcommand
# File lib/chronicle/etl/cli/subcommand_base.rb, line 31 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