Module: Fop::CLI
- Defined in:
- lib/fop/cli.rb
Defined Under Namespace
Classes: Options
Class Method Summary collapse
Class Method Details
.options! ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fop/cli.rb', line 7 def self. = Options.new OptionParser.new do |opts| opts. = "Usage: fop [options] [ 'prog' | -f progfile ] [ file ... ]" opts.on("-fFILE", "--file=FILE", "Read program from file instead of first argument") do |f| .src = File.open(f) .src.advise(:sequential) end opts.on("-c", "--check", "Perform a syntax check on the program and exit") do .check = true end opts.on("-q", "--quiet", "Only print errors and output") do .quiet = true end opts.on("--version", "Print version and exit") do .version = true end end.parse! .src ||= StringIO.new(ARGV.shift || "") end |