class ECSHelper::Command::Base

Attributes

client[RW]
helper[RW]
option_parser[RW]
options[RW]
type[RW]

Public Class Methods

new(helper) click to toggle source
# File lib/ecs_helper/command/base.rb, line 9
def initialize(helper)
  @client = helper.client
  @helper = helper
  @option_parser, @options = cmd_option_parser
  @option_parser.parse!(into: @options)
end

Public Instance Methods

validate() click to toggle source
# File lib/ecs_helper/command/base.rb, line 20
def validate
  required.each do |r|
    value = options[r]
    unless value
      puts "'#{r}' required for command '#{type}'".light_white
      puts option_parser.help
      exit
    end
  end
end

Private Instance Methods

processEqual(value) click to toggle source
# File lib/ecs_helper/command/base.rb, line 37
def processEqual(value)
  value.start_with?('=') ? value[1..-1] : value
end
required() click to toggle source
# File lib/ecs_helper/command/base.rb, line 33
def required
  []
end