Sha256: eb7f980d5203a722cf53f1ebbf48aa450177fa141aa1d009070f19222abbbefb

Contents?: true

Size: 618 Bytes

Versions: 3

Compression:

Stored size: 618 Bytes

Contents

require 'optparse'

module Grog
  class Options
    attr_accessor :number_of_commits_to_show, :show_datetimes

    def self.parse(argv)
      Options.new(argv)
    end

    def initialize(argv)
      @opts = OptionParser.new

      @number_of_commits_to_show = 10
      @opts.on("-n=N", "number of commits to show", Integer) { |val| @number_of_commits_to_show = val }

      @show_datetimes = false
      @opts.on("-d", "show datetimes") { @show_datetimes = true }
      @opts.on_tail("-h", "--help", "Show this message") do
        puts @opts
        exit
      end

      @rest = @opts.parse(argv)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
grog-0.0.2 lib/grog/options.rb
grog-0.0.1 lib/grog/options.rb
grog-0.0.0 lib/grog/options.rb