From 15342d0f6afbb22e699a63a35b4574b8bbf4b3f0 Mon Sep 17 00:00:00 2001 From: Kent 'picat' Gruber Date: Fri, 9 Jul 2021 19:27:55 -0400 Subject: [PATCH] Handle successful/canceled/blocked deployments in CLI output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise the spinner would just end, which felt a bit awkward. I wanted to see a "✓" to know that everything was ok, and a "!" (maybe something else?) if something went wrong. --- command/deployment_status.go | 10 +++++++++- website/content/docs/commands/job/run.mdx | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/command/deployment_status.go b/command/deployment_status.go index 8aa450c6f..0c80aac59 100644 --- a/command/deployment_status.go +++ b/command/deployment_status.go @@ -321,7 +321,15 @@ UPDATE: } else { break UPDATE } - case structs.DeploymentStatusSuccessful, structs.DeploymentStatusCancelled, structs.DeploymentStatusDescriptionBlocked: + case structs.DeploymentStatusSuccessful: + endSpinner = glint.Layout( + glint.Text(fmt.Sprintf("✓ Deployment %q %s", limit(deployID, length), status)), + ).Row().MarginLeft(2) + break UPDATE + case structs.DeploymentStatusCancelled, structs.DeploymentStatusDescriptionBlocked: + endSpinner = glint.Layout( + glint.Text(fmt.Sprintf("! Deployment %q %s", limit(deployID, length), status)), + ).Row().MarginLeft(2) break UPDATE default: q.WaitIndex = meta.LastIndex diff --git a/website/content/docs/commands/job/run.mdx b/website/content/docs/commands/job/run.mdx index f244ad9a3..f6cffefb9 100644 --- a/website/content/docs/commands/job/run.mdx +++ b/website/content/docs/commands/job/run.mdx @@ -153,7 +153,7 @@ $ nomad job run -check-index 6 example.nomad 2021-06-09T16:57:30-07:00: Evaluation status changed: "pending" -> "complete" ==> 2021-06-09T16:57:30-07:00: Evaluation "5ef16dff" finished with status "complete" ==> 2021-06-09T16:57:30-07:00: Monitoring deployment "62eb607c" - ⠙ Deployment "62eb607c" successful + ✓ Deployment "62eb607c" successful 2021-06-09T16:57:30-07:00 ID = 62eb607c