class Lingo::CLI

Attributes

files[R]

Public Class Methods

defaults() click to toggle source
Calls superclass method
# File lib/lingo/cli.rb, line 35
def defaults
  super.merge(
    config:   'lingo.cfg',
    language: 'de',
    profile:  false
  )
end

Public Instance Methods

run(arguments) click to toggle source
# File lib/lingo/cli.rb, line 47
def run(arguments)
  @files = arguments
end

Private Instance Methods

config_present?(config) click to toggle source
# File lib/lingo/cli.rb, line 53
def config_present?(config)
  Lingo.find(:config, config) {}
end
load_config(*) click to toggle source
# File lib/lingo/cli.rb, line 57
def load_config(*)
  @config = {}
end
opts(opts) click to toggle source
# File lib/lingo/cli.rb, line 61
def opts(opts)
  opts.option(:language__LANG, "Language for processing [Default: #{defaults[:language]}]")

  opts.separator

  opts.option(:log__FILE, :L, 'Log file to print debug information to') { |log|
    options[:log] = stderr.reopen(
      log == '-' ? stdout : File.open(log, 'a+', encoding: ENCODING))
  }

  opts.separator

  opts.option(:profile__PATH, :P, 'Print profiling results') { |profile|
    options[:profile] = stdout if profile == '-'
  }
end