Sha256: 30256aa831f560f02800de50909063ac8049ef64650953d7bb1a7f05471b8f9a
Contents?: true
Size: 956 Bytes
Versions: 2
Compression:
Stored size: 956 Bytes
Contents
require 'optparse' require 'source_finder/option_parser' module Punchlist # Parse command line options class Options attr_reader :default_punchlist_line_regexp def initialize(args, source_finder_option_parser: SourceFinder::OptionParser.new) @args = args @source_finder_option_parser = source_finder_option_parser end def parse_regexp(opts, options) opts.on('-r', '--regexp r', 'Regexp to trigger on - ' \ 'default is XXX|TODO') do |v| options[:regexp] = v end end def setup_options(opts) options = {} opts.banner = 'Usage: punchlist [options]' @source_finder_option_parser.add_options(opts, options) parse_regexp(opts, options) options end def parse_options options = nil OptionParser.new do |opts| options = setup_options(opts) end.parse!(@args) options end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
punchlist-1.1.1 | lib/punchlist/options.rb |
punchlist-1.1.0 | lib/punchlist/options.rb |