Class: Icarus::Mod::CLI::SubcommandBase

Inherits:
Base
  • Object
show all
Defined in:
lib/icarus/mod/cli/subcommand_base.rb

Overview

Base class for all subcommands

Direct Known Subclasses

Add, List, Sync, Validate

Class Method Summary collapse

Methods inherited from Base

exit_on_failure?

Class Method Details

rubocop:disable Style/OptionalBooleanParameter



31
32
33
# File 'lib/icarus/mod/cli/subcommand_base.rb', line 31

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

.subcommand_prefixObject

rubocop:enable Style/OptionalBooleanParameter



36
37
38
# File 'lib/icarus/mod/cli/subcommand_base.rb', line 36

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