WIP optional tokens.

master
Luka Vandervelden 2019-10-28 14:06:05 +01:00
parent df718d2a9e
commit 3349c3f251
2 changed files with 3 additions and 0 deletions

View File

@ -79,6 +79,8 @@ commands.push "add", "Adds a service to an environment." do |args|
provider = service.get_default_provider token.token provider = service.get_default_provider token.token
end end
next if provider.nil? && token.optional
if provider.nil? if provider.nil?
STDERR.puts "This service consumes a “#{token.token}” token, but you have not specified what other service is supposed to provide it." STDERR.puts "This service consumes a “#{token.token}” token, but you have not specified what other service is supposed to provide it."
STDERR.puts "Use the `service add #{args[1]} #{token.token}=<provider>` syntax to specify it." STDERR.puts "Use the `service add #{args[1]} #{token.token}=<provider>` syntax to specify it."

View File

@ -4,6 +4,7 @@ require "specparser"
class ServiceDefinition class ServiceDefinition
struct Consumes struct Consumes
getter token : String getter token : String
getter optional : Bool
def initialize(@token) def initialize(@token)
@optional = false @optional = false