Sha256: 3cd7937faa78c78e3617e8c2d8c3b0bf7cb82313a044457ed1d52b54f07d4408

Contents?: true

Size: 803 Bytes

Versions: 1

Compression:

Stored size: 803 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.1 lib/jira_report/cli.rb