Sha256: 8b41da5c70576d2c6b7df3936bc3325d22558cee5be56a09696176782701f0f7

Contents?: true

Size: 772 Bytes

Versions: 1

Compression:

Stored size: 772 Bytes

Contents

require 'optparse'

module JiraReport
  # Prepares command line parameters using OptionParser
  class Cli
    attr_reader :username, :ini

    def initialize
      options = parse
      @username = options[:username]
      @ini = options[:ini] ? options[:ini] : "~/.jira-report"
    end

    private

    def parse
      options = {}
      OptionParser.new do |opts|
        opts.banner = 'Usage: jira-report [options]'
        opts.on('-u', '--username username', 'Username to query activity report.') do |u|
          options[:username] = u
        end
        opts.on('-c', '--config config', 'Path to config file. ' \
                'USER_HOME/.jira-report is default.') do |s|
          options[:ini] = s
        end
      end.parse!
      options
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jira_report-0.0.2 lib/jira_report/cli.rb