Class: Bow::Options
- Inherits:
-
Object
- Object
- Bow::Options
- Defined in:
- lib/bow/options.rb
Constant Summary collapse
- OPTIONS =
[ [ '-uUSER', '--user=USER', 'Remote user (root used by default)', :option_user ], [ '-gGROUP', '--group=GROUP', 'Hosts group (defined in config)', :option_group ], [ '-iINVENTORY', '--inventory=INVENTORY', 'Path to inventory file', :option_inventory ], [ '-c', '--copy-tool', 'Utilit used for files transfer (scp or rsync)', :option_copy_tool ], [ '-v', '--version', 'Print version and exit', :option_version ] ].freeze
Instance Method Summary collapse
-
#initialize(options) ⇒ Options
constructor
A new instance of Options.
- #option_copy_tool(copy_tool) ⇒ Object
- #option_group(group) ⇒ Object
- #option_inventory(inventory) ⇒ Object
- #option_user(user) ⇒ Object
- #option_version(_v) ⇒ Object
- #parse(opts) ⇒ Object
Constructor Details
#initialize(options) ⇒ Options
Returns a new instance of Options.
38 39 40 |
# File 'lib/bow/options.rb', line 38 def initialize() @options = end |
Instance Method Details
#option_copy_tool(copy_tool) ⇒ Object
65 66 67 |
# File 'lib/bow/options.rb', line 65 def option_copy_tool(copy_tool) @options[:copy_tool] = copy_tool end |
#option_group(group) ⇒ Object
57 58 59 |
# File 'lib/bow/options.rb', line 57 def option_group(group) @options[:group] = group end |
#option_inventory(inventory) ⇒ Object
61 62 63 |
# File 'lib/bow/options.rb', line 61 def option_inventory(inventory) @options[:inventory] = inventory end |
#option_user(user) ⇒ Object
53 54 55 |
# File 'lib/bow/options.rb', line 53 def option_user(user) @options[:user] = user end |
#option_version(_v) ⇒ Object
69 70 71 72 |
# File 'lib/bow/options.rb', line 69 def option_version(_v) puts VERSION exit end |
#parse(opts) ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/bow/options.rb', line 42 def parse(opts) OPTIONS.each do |definition| callable = definition.pop opts.on(*definition, method(callable)) end opts.on_tail('-h', '--help', 'Print this help and exit.') do puts opts exit end end |