class Bake::BakeFormatOptions
Attributes
end_line[R]
indent[R]
input[R]
output[R]
start_line[R]
Public Class Methods
new(argv)
click to toggle source
Calls superclass method
Bake::Parser::new
# File lib/format/options/options.rb, line 10 def initialize(argv) super(argv) @input = '-' @output = '-' @start_line = nil @end_line = nil @indent = ' ' @index = 0 add_option(["" ], lambda { |x| collect_args(x) }) add_option(["--indent" ], lambda { |x| @indent = x }) add_option(["--lines" ], lambda { |x| set_lines(x) }) add_option(["-h", "--help" ], lambda { usage; ExitHelper.exit(0) }) add_option(["--version" ], lambda { Bake::Version.printBakeFormatVersion; ExitHelper.exit(0) }) end
Public Instance Methods
parse_options()
click to toggle source
# File lib/format/options/options.rb, line 38 def parse_options() parse_internal(true) end
usage()
click to toggle source
# File lib/format/options/options.rb, line 27 def usage puts [ "Usage: #{__FILE__} [--indent=string] [--lines=string] input output", " --indent=string, indent defaults to two spaces.", " Note, you can escape a tab in bash by ctrl-vTAB with sourrounding \" e.g. \"--input= \"", " --lines=string, [start line]:[end line] - format a range of lines.", " input, filename or '-' for stdin", " output, filename, '-' for stdout, '--' for same as input file" ].join("\n") end