Class: Aircana::CLI::Subcommand

Inherits:
Thor
  • Object
show all
Defined in:
lib/aircana/cli/subcommand.rb

Direct Known Subclasses

App::KBSubcommand, App::PluginSubcommand

Class Method Summary collapse

Class Method Details

rubocop:disable Style/OptionalBooleanParameter



8
9
10
# File 'lib/aircana/cli/subcommand.rb', line 8

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

.subcommand_prefixObject



12
13
14
15
16
17
# File 'lib/aircana/cli/subcommand.rb', line 12

def self.subcommand_prefix
  # Extract the main command name from class name (e.g., "FilesSubcommand" -> "files")
  name.gsub(/.*::/, "").gsub(/Subcommand$/, "").gsub(/^[A-Z]/) do |match|
    match[0].downcase
  end.gsub(/[A-Z]/) { |match| "-#{match[0].downcase}" } # rubocop:disable Style/MultilineBlockChain
end