Fixes and improves `service show`’s CLI.
parent
a3c32905ee
commit
479dffc6a0
|
@ -154,18 +154,19 @@ commands.push "status", "Prints the status of services." do |args|
|
||||||
end
|
end
|
||||||
|
|
||||||
commands.push "show", "Shows a service's configuration and state." do |args|
|
commands.push "show", "Shows a service's configuration and state." do |args|
|
||||||
|
if args.size < 1
|
||||||
|
STDERR << "usage: service show <id> [id [...]]\n"
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
|
args.each do |arg|
|
||||||
|
environment_name, service_name = Service.parse_id arg
|
||||||
|
|
||||||
service = Service.all.find do |service|
|
service = Service.all.find do |service|
|
||||||
unless service.name == args[0]
|
service.name == service_name &&
|
||||||
next false
|
service.environment.name == environment_name
|
||||||
end
|
end
|
||||||
|
|
||||||
env = args[1]? || "root"
|
|
||||||
if service.environment.name != env
|
|
||||||
next false
|
|
||||||
end
|
|
||||||
|
|
||||||
true
|
|
||||||
end
|
|
||||||
if service
|
if service
|
||||||
puts service.summary
|
puts service.summary
|
||||||
else
|
else
|
||||||
|
@ -173,6 +174,7 @@ commands.push "show", "Shows a service's configuration and state." do |args|
|
||||||
exit 2
|
exit 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
commands.push "add-environment", "Creates a new (empty) environment." do |arg|
|
commands.push "add-environment", "Creates a new (empty) environment." do |arg|
|
||||||
Environment.new(args[9]).write ENVIRONMENTS_DIRECTORY
|
Environment.new(args[9]).write ENVIRONMENTS_DIRECTORY
|
||||||
|
|
Loading…
Reference in New Issue