mirror of
https://github.com/martinvonz/jj.git
synced 2024-11-28 09:14:04 +00:00
ui: add write_stderr()
This lets us write to stderr, but unlike write_error(), this won't write with formatting. This will be used for preformatted strings, e.g. those coming from clap.
This commit is contained in:
parent
a52c32adef
commit
470c9f3a5f
1 changed files with 7 additions and 0 deletions
|
@ -147,6 +147,13 @@ impl Ui {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn write_stderr(&mut self, text: &str) -> io::Result<()> {
|
||||
let data = text.as_bytes();
|
||||
match &mut self.output_pair {
|
||||
UiOutputPair::Terminal { stderr, .. } => stderr.write_all(data),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> {
|
||||
match &mut self.output_pair {
|
||||
UiOutputPair::Terminal { stdout, .. } => stdout.write_fmt(fmt),
|
||||
|
|
Loading…
Reference in a new issue