Class: ArgParser

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

Class Method Summary collapse

Class Method Details

.parse(args) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/arg_parser.rb', line 2

def self.parse(args)
  options = OpenStruct.new

  opts = OptionParser.new do |opts|
    opts.on("-a", "--all", "Generate all teeth images's combinations.") do |all|
      options.all = all
    end

    opts.on("-i", "--image IMAGE", "Generate image tooth based on file name.") do |i|
      options.image = i
    end

    opts.on("-f", "--folder FOLDER", "Folder where images are saved. (** Required **)") do |f|
      options.folder = f
    end

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

      exit
    end
  end

  opts.parse!(args)
  options
end