Module: SnapEbs::Options
- Included in:
- SnapEbs
- Defined in:
- lib/snap_ebs/options.rb
Instance Method Summary collapse
-
#option_parser ⇒ Object
Gets the root ‘option_parser`.
Instance Method Details
#option_parser ⇒ Object
Gets the root ‘option_parser`. Plugins do not append to this directly, but instead supply a list of options, arguments, descriptions, and default values. `SnapEbs` manages the namespacing of options, and each plugin receives its own `options` object.
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/snap_ebs/options.rb', line 9 def option_parser unless @option_parser @option_parser = OptionParser.new do |o| o. = "Usage: #{$0} [options]" o.on("-v", "--[no-]verbose", "Run verbosely") do |val| [:verbose] = val end o.on("-a", "--access-key <AWS ACCESS KEY>", "AWS access key") do |val| [:access_key] = val end o.on("-s", "--secret-key <AWS SECRET KEY>", "AWS secret key") do |val| [:secret_key] = val end o.on("-c", "--credentials-file <FILE>", "Load AWS credentials from the downloaded CSV file (overrides -a and -s)") do |val| [:credentials_file] = val end o.on("-m", "--[no-]mock", "Mock out AWS calls for testing in Vagrant") do |val| [:mock] = val end o.on("-l", "--logfile FILE", "Path to a file used for logging") do |filename| .logfile = filename end o.on("-f", "--fs-freeze", "Freeze filesystems for fsfreeze or xfs_freeze before snapping (unfreezes after)") do |fs_freeze| .fs_freeze = fs_freeze end o.on("-d", "--directory PATH", "Only snap volumes mounted to PATH, a comma-separated list of directories") do |d| .directory = d end end plugins.each { |plugin| plugin. @option_parser } end @option_parser end |