class NG1BuildHelpers::CircleCI::OptionsParser

Public Class Methods

parse(options) click to toggle source
# File lib/circleci/circleci.rb, line 17
def self.parse(options)
    args = Options.new()
    args.export = false
       
    opt_parser = OptionParser.new do |opts|
        opts.banner = "Usage: #{__FILE__} [options]"
    
        opts.on("-u", "--url URL", "Specify the URL for CircleCI instance") do |url|
            args.url = url
        end
        
        opts.on("-c", "--company COMPANY", "Specify the company for CircleCI") do |company|
            args.company = company
        end

        opts.on("-p", "--project PROJECT", "Specify the project for CircleCI") do |project|
            args.project = project
        end

        opts.on("-b", "--branch BRANCH", "Specify the branch for CircleCI") do |branch|
            args.branch = branch
        end

        opts.on("-t", "--token TOKEN", "Specify the token for CircleCI") do |token|
            args.token = token
        end

        opts.on("-e", "--export", "Output range for use as a parameter to the 'export' bash command") do 
            args.export = true
        end

        opts.on_tail("-h", "--help", "Show this message") do
            puts opts
            exit
        end
    end

    opt_parser.parse!(options)
    return args   
end