-
Notifications
You must be signed in to change notification settings - Fork 3
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
refactor: Improve CLI output #122
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
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.
Haven't reviewed the rest, but a few things stood out to me
where | ||
Self: std::error::Error, | ||
{ | ||
fn into_error_report(self) -> std::result::Result<String, std::fmt::Error>; |
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.
This looks very similar to #[snafu::report]
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, but there is no color output and not many other options to customize the output.
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.
That's a lot of code for a very niche use case.
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 guess we could maybe upstream some improvements, but I really want to have full control over the error output.
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.
Makes sense about the control/formatting. I think we should let this through, and if there's a way to do it via snafu::report
, then we could do so in a future PR (shouldn't impact the end user).
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.
Looking good. I left some comments, which were mostly caused by my lack of understanding.
Keen to go through each with you @Techassi - we can mark most of them as resolved without any change.
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.
First part for me, did not really check or test the code yet.
rust/stackable-cockpit/src/platform/cluster/resource_request.rs
Outdated
Show resolved
Hide resolved
Co-authored-by: Malte Sander <[email protected]>
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.
LGTM, just left one comment
|
||
#[snafu(display("no stdin error"))] | ||
StdinError, | ||
#[snafu(display("failed to start kind command"))] |
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.
Kind eventually needs to be in title case, but I wouldn't block the PR for that.
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. Will open a follow-up PR for that. Let's move for now.
Fixes #59, part of #98, supersedes #55
This PR improves the CLI output for errors, progress and results. It tries to unify the complex output composition in a central place, which makes styling and formatting easier and subcommands don't need to re-implement common output patterns over and over again.
NOTE: This PR wanted to much all at once. That's why it only implements the error and general output improvements. Proper color (and
NO_COLOR
) and progress spinner support will be added in separate PRs.