service: service add <service-id> [token=provider [...]]

master
Luka Vandervelden 2019-10-24 17:53:36 +02:00
parent 59b78e3af5
commit c6dd306361
1 changed files with 5 additions and 4 deletions

View File

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