-
Notifications
You must be signed in to change notification settings - Fork 76
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
Move snapshot output to the rich output system. #1524
Conversation
Json, | ||
} | ||
|
||
impl Default for Output { | ||
impl Default for OutputFile { |
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.
We use the term Output elsewhere for the output type, where the output isn't a file, could we keep it as is, and change the output
module to print
since it's for printing specifically?
print!("🪣 Downloading bucket {bucket_index} {bucket}"); | ||
let message = format!("Downloading bucket {bucket_index} {bucket}"); | ||
|
||
output.print("🪣", format!("{message}…"), false); |
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.
Can we add a .bucket
function instead of hardcoding this one emoji unlike the others?
pub fn print<T: Display>(&self, icon: &str, message: T, new_line: bool) { | ||
if self.quiet { | ||
return; | ||
} | ||
|
||
if new_line { | ||
eprintln!("{icon} {message}"); | ||
} else { | ||
eprint!("{icon} {message}"); |
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.
For consistency with the Rust stdlib, it'd be helpful if we operated the newline option via different function names, print
and println
like:
Other functions can then also get two variants, check
and checkln
.
Then I think we don't need the icon
parameter to print and it can simply accept a &str
(or preferably a Display
). For example, the use would be:
output.globeln(format!("Downloading history {history_url}"));
...
output.bucket(format!("Downloading bucket {bucket_index} {bucket}…"));
...
output.println("({size})");
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 wonder if we actually need this, because most of these functions won't be used without the line break. The idea was just supporting the minority of cases via the centralized print
function. I get the pattern, but I think in this case is too much.
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 also wonder if we should use a macro to generate these functions, as they're essentially the same thing.
Close in favor of #1531 |
What
output.mp4
Why
So we have one standardized way of doing it.
Known limitations
N/A