Service#summary cleaned a bit.
Not provided tokens will also be printed in red.master
parent
9a93937176
commit
5aadf3c7ed
33
src/main.cr
33
src/main.cr
|
@ -1,5 +1,6 @@
|
||||||
require "option_parser"
|
require "option_parser"
|
||||||
require "yaml"
|
require "yaml"
|
||||||
|
require "colorize"
|
||||||
|
|
||||||
# Those are set to local to make testing easier.
|
# Those are set to local to make testing easier.
|
||||||
PID_DIRECTORY = "./pid"
|
PID_DIRECTORY = "./pid"
|
||||||
|
@ -302,17 +303,31 @@ class Service
|
||||||
def summary
|
def summary
|
||||||
"Name: #{name}\n" +
|
"Name: #{name}\n" +
|
||||||
"Environment: #{environment.name} (#{environment.type.to_s.downcase})\n" +
|
"Environment: #{environment.name} (#{environment.type.to_s.downcase})\n" +
|
||||||
"Provides:\n" +
|
(
|
||||||
(provides.map { |x| " - " + x.token + "\n" }).join +
|
if provides.size > 0
|
||||||
"Consumes:\n" +
|
"Provides:\n" +
|
||||||
(@reference.consumes.map { |x|
|
(provides.map { |x| " - " + x.token + "\n" }).join
|
||||||
provider = @providers[x.token]?
|
|
||||||
if provider
|
|
||||||
" - #{x.token} (from #{provider.to_s})\n"
|
|
||||||
else
|
else
|
||||||
" - #{x.token} (NOT CURRENTLY PROVIDED)\n"
|
""
|
||||||
end
|
end
|
||||||
}).join
|
) +
|
||||||
|
(
|
||||||
|
if @reference.consumes.size > 0
|
||||||
|
"Consumes:\n" +
|
||||||
|
(@reference.consumes.map { |x|
|
||||||
|
provider = @providers[x.token]?
|
||||||
|
if provider
|
||||||
|
" - #{x.token} (from #{provider.id})\n"
|
||||||
|
else
|
||||||
|
" - #{x.token} " +
|
||||||
|
"(NOT CURRENTLY PROVIDED)".colorize(:red).to_s +
|
||||||
|
"\n"
|
||||||
|
end
|
||||||
|
}).join
|
||||||
|
else
|
||||||
|
""
|
||||||
|
end
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
class_getter all = [] of Service
|
class_getter all = [] of Service
|
||||||
|
|
Loading…
Reference in New Issue