Handle successful/canceled/blocked deployments in CLI output

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.
This commit is contained in:
Kent 'picat' Gruber 2021-07-09 19:27:55 -04:00
parent 6b80e5aaf0
commit 15342d0f6a
2 changed files with 10 additions and 2 deletions

View file

@ -321,7 +321,15 @@ UPDATE:
} else { } else {
break UPDATE 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 break UPDATE
default: default:
q.WaitIndex = meta.LastIndex q.WaitIndex = meta.LastIndex

View file

@ -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 status changed: "pending" -> "complete"
==> 2021-06-09T16:57:30-07:00: Evaluation "5ef16dff" finished with status "complete" ==> 2021-06-09T16:57:30-07:00: Evaluation "5ef16dff" finished with status "complete"
==> 2021-06-09T16:57:30-07:00: Monitoring deployment "62eb607c" ==> 2021-06-09T16:57:30-07:00: Monitoring deployment "62eb607c"
Deployment "62eb607c" successful Deployment "62eb607c" successful
2021-06-09T16:57:30-07:00 2021-06-09T16:57:30-07:00
ID = 62eb607c ID = 62eb607c