Class: Bake::BakecleanOptions

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Parser

#add_option, #get_block, #num_parameter?, #parse_internal, #valid?

Constructor Details

#initialize(argv) ⇒ BakecleanOptions

Returns a new instance of BakecleanOptions.



9
10
11
12
13
14
15
16
17
# File 'lib/bakeclean/options/options.rb', line 9

def initialize(argv)
  super(argv)

  @preview = false

  add_option(["--preview"    ], lambda { @preview = true                                         })
  add_option(["-h", "--help" ], lambda { usage; ExitHelper.exit(0)                               })
  add_option(["--version"    ], lambda { Bake::Version.printBakecleanVersion; ExitHelper.exit(0) })
end

Instance Attribute Details

#previewObject (readonly)

Boolean



7
8
9
# File 'lib/bakeclean/options/options.rb', line 7

def preview
  @preview
end

Instance Method Details

#parse_optionsObject



26
27
28
# File 'lib/bakeclean/options/options.rb', line 26

def parse_options()
  parse_internal(false)
end

#usageObject



19
20
21
22
23
24
# File 'lib/bakeclean/options/options.rb', line 19

def usage
  puts "\nUsage: bakeclean [options]"
  puts " --preview        Only shows the folder which would be deleted."
  puts " --version        Print version."
  puts " -h, --help       Print this help."
end