Module: Ios3::CLI::Options

Defined in:
lib/ios3/cli.rb

Class Method Summary collapse

Class Method Details

.parse!(args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ios3/cli.rb', line 7

def self.parse!(args)
  options = {}
  optparse = OptionParser.new do |opts|
    opts.banner = "Usage: ios3 [options]"

    options[:preserve_ipa] = false
    opts.on( '-p', '--preserve-ipa', 'Leave a copy of the .ipa file in the current directory' ) do
      options[:preserve_ipa] = true
    end

    options[:preserve_manifest] = false
    opts.on( '-m', '--preserve-manifest', 'Leave a copy of the manifest.plist file in the current directory' ) do
      options[:preserve_manifest] = true
    end

    opts.on( '-h', '--help', 'Display this screen' ) do
      puts opts
      exit
    end
  end
  begin
    optparse.parse!(args)
  rescue
    puts $!
    puts optparse
    exit
  end

  options
end