Class: WayOfWorking::SubCommands::Base

Inherits:
Thor
  • Object
show all
Defined in:
lib/way_of_working/sub_commands/base.rb

Overview

This base class enables subcommands to work correctly with help. See: github.com/rails/thor/wiki/Subcommands#subcommands-that-work-correctly-with-help

Direct Known Subclasses

Exec, Init, New

Class Method Summary collapse

Class Method Details



10
11
12
# File 'lib/way_of_working/sub_commands/base.rb', line 10

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

.subcommand_prefixObject



14
15
16
17
# File 'lib/way_of_working/sub_commands/base.rb', line 14

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