class Lingo::CLI

Attributes

files[R]

Public Class Methods

defaults() click to toggle source
# File lib/lingo/cli.rb, line 34
def defaults
  super.merge(
    config:   'lingo.cfg',
    language: 'de',
    status:   false,
    perfmon:  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

load_config(*) click to toggle source
# File lib/lingo/cli.rb, line 53
def load_config(*)
  @config = {}
end
opts(opts) click to toggle source
# File lib/lingo/cli.rb, line 57
def opts(opts)
  opts.on('-c', '--config YAML', "Config file [Default: #{defaults[:config]}#{' (currently not present)' unless File.readable?(defaults[:config])}]") { |config|
    options[:config] = config
  }

  opts.separator ''

  opts.on('-l', '--language LANG', "Language for processing [Default: #{defaults[:language]}]") { |language|
    options[:language] = language
  }

  opts.separator ''

  opts.on('-s', '--status', 'Print status information after processing') {
    options[:status] = true
  }

  opts.on('-p', '--perfmon', 'Print performance details after processing') {
    options[:perfmon] = true
  }

  opts.separator ''

  opts.on('-L', '--log FILE', 'Log file to print debug and status information to') { |log|
    options[:log] = @stderr.reopen(File.open(log, 'a+', encoding: ENC))
  }
end