pub fn visualize_fake_command_output(
    status: i32,
    stdout: &str,
    stderr: &str,
    title_style: &Style,
) -> String {
    let mut result = format!("\n{} {}\n", title_style.paint("status"), status);
    let mut write_stream = |title, stream: &str| {
        writeln!(result, "{}", title_style.paint(title)).expect("write title");
        for line in stream.split('\n') {
            let line = line.replace("\r", "\r  "); // make sure "\r" does not delete indentation
            writeln!(result, "{}", line).expect("write line");
        }
    };
    write_stream("stdout", stdout);
    write_stream("stderr", stderr);
    result
}
/// Show status code, stdout, and stderr of a command in a pretty manner
Show status code, stdout, and stderr of a command in a pretty manner
Show status code stdout and stderr of a command in a pretty manner
pub fn visualize_fake_command_output(
    status: i32,
    stdout: &str,
    stderr: &str,
    title_style: &Style,
) -> String {
    let mut result = format!("\n{} {}\n", title_style.paint("status"), status);
    let mut write_stream = |title, stream: &str| {
        writeln!(result, "{}", title_style.paint(title)).expect("write title");
        for line in stream.split('\n') {
            let line = line.replace("\r", "\r  "); // make sure "\r" does not delete indentation
            writeln!(result, "{}", line).expect("write line");
        }
    };
    write_stream("stdout", stdout);
    write_stream("stderr", stderr);
    result
}
pub fn visualize_fake_command_output ( status : i32 , stdout : & str , stderr : & str , title_style : & Style , ) -> String { let mut result = format ! ( " \n \n " title_style paint ( " " ) status ) ; let mut write_stream = | title , stream : & str | { writeln ! ( result " " title_style paint ( title ) ) . expect ( " " ) ; for line in stream . split ( '\n' ) { let line = line . replace ( " \r " , " \r " ) ; // make sure "\r" does not delete indentation writeln ! ( result " " line ) . expect ( " " ) ; } } ; write_stream ( " " , stdout ) ; write_stream ( " " , stderr ) ; result }
Show status code, stdout, and stderr of a command in a pretty manner
Show status code stdout and stderr of a command in a pretty manner
status
i32
stdout
&str
stderr
&str
title_style
&Style
status
i32
stdout
&str
stderr
&str
title_style
&Style