Sha256: d0645d8d4eb6f813ebde7dd761a79645c5a48e1cbc3f5c155ea4ad80aa387d75

Contents?: true

Size: 968 Bytes

Versions: 3

Compression:

Stored size: 968 Bytes

Contents

# frozen_string_literal: true

require "rubycritic/cli/options/argv"

module Skunk
  module Cli
    # :nodoc:
    class Options
      # Extends RubyCritic::Cli::Options::Argv to parse a subset of the
      # parameters accepted by RubyCritic
      class Argv < RubyCritic::Cli::Options::Argv
        def parse # rubocop:disable Metrics/MethodLength
          parser.new do |opts|
            opts.banner = "Usage: skunk [options] [paths]\n"

            opts.on("-b", "--branch BRANCH", "Set branch to compare") do |branch|
              self.base_branch = String(branch)
              set_current_branch
              self.mode = :compare_branches
            end

            opts.on_tail("-v", "--version", "Show gem's version") do
              self.mode = :version
            end

            opts.on_tail("-h", "--help", "Show this message") do
              self.mode = :help
            end
          end.parse!(@argv)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
skunk-0.4.2 lib/skunk/cli/options/argv.rb
skunk-0.4.1 lib/skunk/cli/options/argv.rb
skunk-0.4.0 lib/skunk/cli/options/argv.rb