Class: I18nFlow::CLI::CommandBase

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n_flow/cli/command_base.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ CommandBase

Returns a new instance of CommandBase.



10
11
12
13
# File 'lib/i18n_flow/cli/command_base.rb', line 10

def initialize(args)
  @args    = args.dup
  @options = I18nFlow::Util::parse_options(@args)
end

Instance Method Details

#color_enabled?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/i18n_flow/cli/command_base.rb', line 29

def color_enabled?
  options['nocolor'].nil?
end

#exit_with_message(status, *args) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/i18n_flow/cli/command_base.rb', line 19

def exit_with_message(status, *args)
  if status.zero?
    puts(*args)
  else
    $stderr.puts(*args)
  end

  exit status
end

#invoke!Object



15
16
17
# File 'lib/i18n_flow/cli/command_base.rb', line 15

def invoke!
  raise 'Not implemented'
end