forked from mirrors/jj
ui: remove write*() and flush() methods
This will force us to think about the output stream to print to. Typically we'll use stdout_formatter() for data, and stderr() for the other messages.
This commit is contained in:
parent
7a3e72415c
commit
e6f49552d0
1 changed files with 2 additions and 18 deletions
|
@ -298,18 +298,6 @@ impl Ui {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn write(&mut self, text: &str) -> io::Result<()> {
|
||||
self.stdout().write_all(text.as_bytes())
|
||||
}
|
||||
|
||||
pub fn write_stderr(&mut self, text: &str) -> io::Result<()> {
|
||||
self.stderr().write_all(text.as_bytes())
|
||||
}
|
||||
|
||||
pub fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> {
|
||||
self.stdout().write_fmt(fmt)
|
||||
}
|
||||
|
||||
pub fn hint(&self) -> LabeledWriter<Box<dyn Formatter + '_>, &'static str> {
|
||||
LabeledWriter::new(self.stderr_formatter(), "hint")
|
||||
}
|
||||
|
@ -322,10 +310,6 @@ impl Ui {
|
|||
LabeledWriter::new(self.stderr_formatter(), "error")
|
||||
}
|
||||
|
||||
pub fn flush(&mut self) -> io::Result<()> {
|
||||
self.stdout().flush()
|
||||
}
|
||||
|
||||
/// Waits for the pager exits.
|
||||
#[instrument(skip_all)]
|
||||
pub fn finalize_pager(&mut self) {
|
||||
|
@ -351,8 +335,8 @@ impl Ui {
|
|||
"Cannot prompt for input since the output is not connected to a terminal",
|
||||
));
|
||||
}
|
||||
write!(self, "{prompt}: ")?;
|
||||
self.flush()?;
|
||||
write!(self.stdout(), "{prompt}: ")?;
|
||||
self.stdout().flush()?;
|
||||
let mut buf = String::new();
|
||||
io::stdin().read_line(&mut buf)?;
|
||||
Ok(buf)
|
||||
|
|
Loading…
Reference in a new issue