Sha256: 4bd64a5bbf9e4afa39c6c99ccaf7e4b321acf8b74c0c4f5b91e30ce78c639302

Contents?: true

Size: 1.02 KB

Versions: 18

Compression:

Stored size: 1.02 KB

Contents

require_relative 'source_file_globber'

module SourceFinder
  # Brings in command-line options to configure SourceFinder--usable
  # with the ruby OptionParser class, brought in with 'require
  # "optparse"'
  class OptionParser
    def fresh_globber
      SourceFinder::SourceFileGlobber.new
    end

    def default_source_files_glob
      fresh_globber.source_files_glob
    end

    def default_source_files_exclude_glob
      fresh_globber.source_files_exclude_glob
    end

    def add_glob_option(opts, options)
      opts.on('-g glob here', '--glob',
              'Which files to parse - ' \
              "default is #{default_source_files_glob}") do |v|
        options[:glob] = v
      end
    end

    def add_exclude_glob_option(opts, options)
      opts.on('-e glob here', '--exclude-glob',
              'Files to exclude - default is none') do |v|
        options[:exclude] = v
      end
    end

    def add_options(opts, options)
      add_glob_option(opts, options)
      add_exclude_glob_option(opts, options)
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
source_finder-3.2.1 lib/source_finder/option_parser.rb
source_finder-3.2 lib/source_finder/option_parser.rb
source_finder-3.1.1 lib/source_finder/option_parser.rb
source_finder-3.1.0 lib/source_finder/option_parser.rb
source_finder-3.0.0 lib/source_finder/option_parser.rb
source_finder-2.4.1 lib/source_finder/option_parser.rb
source_finder-2.4.0 lib/source_finder/option_parser.rb
source_finder-2.3.2 lib/source_finder/option_parser.rb
source_finder-2.3.1 lib/source_finder/option_parser.rb
source_finder-2.3.0 lib/source_finder/option_parser.rb
source_finder-2.2.3 lib/source_finder/option_parser.rb
source_finder-2.2.2 lib/source_finder/option_parser.rb
source_finder-2.2.1 lib/source_finder/option_parser.rb
source_finder-2.2.0 lib/source_finder/option_parser.rb
source_finder-2.1.1 lib/source_finder/option_parser.rb
source_finder-2.1.0 lib/source_finder/option_parser.rb
source_finder-2.0.0 lib/source_finder/option_parser.rb
source_finder-1.1.1 lib/source_finder/option_parser.rb