service: service add <service-id> [token=provider [...]]
parent
59b78e3af5
commit
c6dd306361
|
@ -49,24 +49,25 @@ begin
|
||||||
if args[0] == "help"
|
if args[0] == "help"
|
||||||
puts parser
|
puts parser
|
||||||
elsif args[0] == "add"
|
elsif args[0] == "add"
|
||||||
environment : String? = nil
|
|
||||||
providers = Hash(String, String).new
|
providers = Hash(String, String).new
|
||||||
|
|
||||||
|
environment, service = Service.parse_id args[1]
|
||||||
|
|
||||||
|
args.shift
|
||||||
args.each_with_index do |arg, i|
|
args.each_with_index do |arg, i|
|
||||||
next if i == 0
|
next if i == 0
|
||||||
|
|
||||||
match = arg.match /(.*)=(.*)/
|
match = arg.match /(.*)=(.*)/
|
||||||
|
|
||||||
if match.nil?
|
if match.nil?
|
||||||
# FIXME: Check environment is not defined already.
|
raise ::Service::Exception.new "usage: service add <service> <token=provider>"
|
||||||
environment = arg
|
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
providers[match[1]] = match[2]
|
providers[match[1]] = match[2]
|
||||||
end
|
end
|
||||||
|
|
||||||
Service.new(args[1], environment).tap do |service|
|
Service.new(service, environment).tap do |service|
|
||||||
service.consumes.each do |token|
|
service.consumes.each do |token|
|
||||||
provider = providers[token.token]?
|
provider = providers[token.token]?
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue