Class: BaseSubCommand

Inherits:
Thor
  • Object
show all
Defined in:
lib/command/base_sub_command.rb

Overview

Class Method Summary collapse

Methods inherited from Thor

basename

Class Method Details

rubocop:disable Style/OptionalBooleanParameter



5
6
7
# File 'lib/command/base_sub_command.rb', line 5

def self.banner(command, _namespace = nil, _subcommand = false) # rubocop:disable Style/OptionalBooleanParameter
  "#{basename} #{subcommand_prefix} #{command.usage}"
end

.subcommand_prefixObject



9
10
11
12
13
14
# File 'lib/command/base_sub_command.rb', line 9

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