service/src/get-port.cr

19 lines
358 B
Crystal

require "./config.cr"
require "./service/environment.cr"
require "./service/service_definition.cr"
require "./service/service.cr"
context = Service::Context.new
context.load
if ARGV.size != 2
STDERR.puts "usage: get-port <service-id> <port-id>"
exit 1
end
service_id, port_id = ARGV
puts context.get_service_by_id(service_id).not_nil!.ports[port_id]