Method: GetText::RGetText.check_options
- Defined in:
- lib/gettext/tools/rgettext.rb
.check_options ⇒ Object
:nodoc:
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/gettext/tools/rgettext.rb', line 160 def # :nodoc: output = STDOUT opts = OptionParser.new opts. = _("Usage: %s input.rb [-r parser.rb] [-o output.pot]") % $0 opts.separator("") opts.separator(_("Extract translatable strings from given input files.")) opts.separator("") opts.separator(_("Specific options:")) opts.on("-o", "--output=FILE", _("write output to specified file")) do |out| unless FileTest.exist? out output = File.new(File.(out), "w+") else $stderr.puts(_("File '%s' already exists.") % out) exit 1 end end opts.on("-r", "--require=library", _("require the library before executing rgettext")) do |out| require out end opts.on("-d", "--debug", _("run in debugging mode")) do $DEBUG = true end opts.on_tail("--version", _("display version information and exit")) do puts "#{$0} #{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, output] end |