Method: GetText::RMsgfmt#check_options

Defined in:
lib/gettext/tools/rmsgfmt.rb

#check_optionsObject

:nodoc:



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/gettext/tools/rmsgfmt.rb', line 42

def check_options # :nodoc:
  output = nil

  opts = OptionParser.new
  opts.banner = _("Usage: %s input.po [-o output.mo]" % $0)
  opts.separator("")
  opts.separator(_("Generate binary message catalog from textual translation description."))
  opts.separator("")
  opts.separator(_("Specific options:"))

  opts.on("-o", "--output=FILE", _("write output to specified file")) do |out|
    output = out
  end

  opts.on_tail("--version", _("display version information and exit")) do
    puts "#{$0} #{GetText::VERSION}"
    puts "#{File.join(Config::CONFIG["bindir"], Config::CONFIG["RUBY_INSTALL_NAME"])} #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
    exit
  end
  opts.parse!(ARGV)

  if ARGV.size == 0
    puts opts.help
    exit 1
  end

  [ARGV[0], output]
end