class CC::CLI::Command
Constants
- CODECLIMATE_YAML
- NAMESPACE
Public Class Methods
[](name)
click to toggle source
# File lib/cc/cli/command.rb, line 27 def self.[](name) all.find { |command| command.name == "#{NAMESPACE}::#{name}" || command.command_name == name } end
abstract!()
click to toggle source
# File lib/cc/cli/command.rb, line 15 def self.abstract! @abstract = true end
abstract?()
click to toggle source
# File lib/cc/cli/command.rb, line 19 def self.abstract? @abstract == true end
all()
click to toggle source
# File lib/cc/cli/command.rb, line 23 def self.all @@subclasses.reject(&:abstract?) end
command_name()
click to toggle source
# File lib/cc/cli/command.rb, line 66 def self.command_name name.gsub(/^#{NAMESPACE}::/, "").split("::").map do |part| part.split(/(?=[A-Z])/).map(&:downcase).join("-") end.join(":") end
help()
click to toggle source
# File lib/cc/cli/command.rb, line 50 def self.help if const_defined? :HELP self::HELP else short_help end end
inherited(subclass)
click to toggle source
rubocop: disable Style/ClassVars
# File lib/cc/cli/command.rb, line 32 def self.inherited(subclass) @@subclasses ||= [] @@subclasses << subclass end
new(args = [])
click to toggle source
# File lib/cc/cli/command.rb, line 58 def initialize(args = []) @args = args end
short_help()
click to toggle source
# File lib/cc/cli/command.rb, line 42 def self.short_help if const_defined? :SHORT_HELP self::SHORT_HELP else "" end end
synopsis()
click to toggle source
rubocop: enable Style/ClassVars
# File lib/cc/cli/command.rb, line 38 def self.synopsis "#{command_name} #{self::ARGUMENT_LIST if const_defined?(:ARGUMENT_LIST)}".strip end
Public Instance Methods
execute()
click to toggle source
# File lib/cc/cli/command.rb, line 72 def execute run end
run()
click to toggle source
# File lib/cc/cli/command.rb, line 62 def run $stderr.puts "unknown command #{self.class.name.split("::").last.underscore}" end
Private Instance Methods
filesystem()
click to toggle source
# File lib/cc/cli/command.rb, line 78 def filesystem @filesystem ||= CC::Analyzer::Filesystem.new( CC::Analyzer::MountedPath.code.container_path, ) end