Implement `-t' CLI option switch to specify target

This commit is contained in:
Thibault Jouan
2014-06-27 17:32:42 +00:00
parent e423a66d5c
commit e6ee3d5f77
6 changed files with 44 additions and 7 deletions

View File

@@ -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

View File

@@ -25,7 +25,7 @@ module Producer
end
def target(hostname)
env.target = hostname
env.target ||= hostname
end
def task(name, *args, &block)