-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display formatted status during status wait #2261
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raphink Thanks for this update Raphael!
status/k8s.go
Outdated
@@ -357,9 +358,18 @@ func (k *K8sStatusCollector) Status(ctx context.Context) (*Status, error) { | |||
} | |||
if !k.statusIsReady(s) && k.params.Wait { | |||
time.Sleep(defaults.WaitRetryInterval) | |||
statusFmt := s.Format() | |||
for i := 1; i < lines; i++ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we could use a progress bar for this. Likely there might be other places that could benefit with user feedback.
We should probably use a help func to clear out the output if any.
nit: Docs might help here to indicate what this sequence does...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, the sequence is to set the cursor one line up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for the progress bar, I'm not a big fan because:
- we can't really know the % progress
- as a user, I'd rather have details of what is going on (and see if something is stuck) in the same format as
cilium status
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raphink Thanks for the updates!
status/k8s.go
Outdated
@@ -357,13 +358,28 @@ func (k *K8sStatusCollector) Status(ctx context.Context) (*Status, error) { | |||
} | |||
if !k.statusIsReady(s) && k.params.Wait { | |||
time.Sleep(defaults.WaitRetryInterval) | |||
if k.params.Output != "json" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use the predefined const. Also perhaps best to check summary
vs json
in case other fmts are exposed in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The const is in a package I can't import though, because that creates a dependency loop. Should we move the const to another package?
status/k8s.go
Outdated
continue | ||
} | ||
|
||
for i := 1; i < lines; i++ { | ||
fmt.Print("\033[A\033[2K") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this sequence fare on different platforms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be pretty safe on Linux and MacOS. On Windows, it ANSI codes seem to be well supported for Windows 10+.
@derailed I believe I've addressed all comments! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raphink Thank you for the updates Raphael!
I think all jobs need to be rerun, looks like there was an issue with |
21a4403
to
5b2b89e
Compare
OK, let's run again 👍🏼 |
still broken 😢 |
5b2b89e
to
51d98c5
Compare
That's really weird though, that repo works on my machine 🤔 |
51d98c5
to
cb4fffc
Compare
Signed-off-by: Raphaël Pinson <[email protected]>
Signed-off-by: Raphaël Pinson <[email protected]>
Signed-off-by: Raphaël Pinson <[email protected]>
Signed-off-by: Raphaël Pinson <[email protected]>
Signed-off-by: Raphaël Pinson <[email protected]>
cb4fffc
to
0089336
Compare
Signed-off-by: Raphaël Pinson [email protected]