From 3349c3f25121e4b568c8b378ccc5335ad0d510fa Mon Sep 17 00:00:00 2001 From: Luka Vandervelden Date: Mon, 28 Oct 2019 14:06:05 +0100 Subject: [PATCH] WIP optional tokens. --- src/service.cr | 2 ++ src/service/service_definition.cr | 1 + 2 files changed, 3 insertions(+) diff --git a/src/service.cr b/src/service.cr index 23da9ae..ae0ddcd 100644 --- a/src/service.cr +++ b/src/service.cr @@ -79,6 +79,8 @@ commands.push "add", "Adds a service to an environment." do |args| provider = service.get_default_provider token.token end + next if provider.nil? && token.optional + 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 "Use the `service add #{args[1]} #{token.token}=` syntax to specify it." diff --git a/src/service/service_definition.cr b/src/service/service_definition.cr index bf1e53e..e99711b 100644 --- a/src/service/service_definition.cr +++ b/src/service/service_definition.cr @@ -4,6 +4,7 @@ require "specparser" class ServiceDefinition struct Consumes getter token : String + getter optional : Bool def initialize(@token) @optional = false