Implement `-t' CLI option switch to specify target
This commit is contained in:
@@ -34,12 +34,14 @@ module Producer
|
||||
end
|
||||
|
||||
def parse_arguments!
|
||||
@arguments = arguments.inject([]) do |m, e|
|
||||
@arguments = arguments.each_with_index.inject([]) do |m, (e, i)|
|
||||
case e
|
||||
when '-v'
|
||||
env.verbose = true
|
||||
when '-n'
|
||||
env.dry_run = true
|
||||
when '-t'
|
||||
env.target = arguments.delete_at i + 1
|
||||
else
|
||||
m << e
|
||||
end
|
||||
|
@@ -25,7 +25,7 @@ module Producer
|
||||
end
|
||||
|
||||
def target(hostname)
|
||||
env.target = hostname
|
||||
env.target ||= hostname
|
||||
end
|
||||
|
||||
def task(name, *args, &block)
|
||||
|
Reference in New Issue
Block a user