Class: Appload::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/appload/options.rb

Overview

This class handles argument parsing

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOptions

Returns a new instance of Options.



8
9
10
11
# File 'lib/appload/options.rb', line 8

def initialize
  @options = {}
  parse_args
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/appload/options.rb', line 6

def options
  @options
end

Instance Method Details

#parse_argsObject

Parsing arguments into hash form



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/appload/options.rb', line 14

def parse_args
  raise 'Need to specify ipa path' unless ARGV[0]

  OptionParser.new do |opts|
    opts.banner = 'Usage: appload ipa'

    opts.on('-h', '--help', 'Display usage') do
      puts 'Usage: appload ipa'
      exit
    end

    @options[:ipa_path] = ARGV[0]
  end
end