Sha256: 80398df60a3879d250ee3dcfa8b4c78d8ffce605721c9d0fb651c57fa0f0b91a

Contents?: true

Size: 884 Bytes

Versions: 4

Compression:

Stored size: 884 Bytes

Contents

# Copyright (c) 2015 Scott Williams

require "optparse"
require "issue_exporter"

module IssueExporting
  module CLI

    def run
      begin
        OptionParser.new do |opts|
          define_options opts
          opts.on "-h", "--help" do
            puts usage
            exit
          end

          opts.on "--version" do
            puts about
            exit
          end

        end.parse!
      rescue OptionParser::ParseError => e
        raise UsageError, e
      end

      fail UsageError, "missing argument" if ARGV.empty?
      fail UsageError, "incorrect number of arguments" unless correct_number_of_args ARGV.count
      ARGV.each_with_index { |arg, index| process_input arg, index }
      perform_action()

    rescue UsageError => e
      puts "#{$PROGRAM_NAME}: #{e}\nTry `#{$PROGRAM_NAME} --help` for more information."
      exit false
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
github_issue_exporter-0.3.1 lib/issue_exporter/cli.rb
github_issue_exporter-0.3.0 lib/issue_exporter/cli.rb
github_issue_exporter-0.2.1 lib/issue_exporter/cli.rb
github_issue_exporter-0.2.0 lib/issue_exporter/cli.rb