#!/usr/bin/env ruby -W # Copyright (c) 2015 Scott Williams $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/../lib") require "issue_exporter/cli" module IssueExporting class Command include CLI def about VERSION end def usage <= 4 end def define_options(opts) opts.on("--directory") { |arg| @directory = arg } end def perform_action process_args if has_directory? importer = IssueExporting::DirectoryImporter.new @directory_to_parse importer.import else importer = IssueExporting::Importer.new @files, @owner, @repo, @token importer.import end end # TODO: handle directory flag def process_args if has_directory? @directory_to_parse = @args[0] else @files = @args[0...@args.count-3] @owner = @args[@args.count-3] @repo = @args[@args.count-2] @token = @args[@args.count-1] end end def process_input(arg, index) @args << arg end private def has_directory? !@directory.nil? end end end IssueExporting::Command.new.run