~exitb/retrofit

5b98e45fb9ba56856d3cd9f5666fb3d70d399f6e — exitb 1 year, 10 months ago 93cb7f8
Allow verbose output
1 files changed, 12 insertions(+), 0 deletions(-)

M src/main.rs
M src/main.rs => src/main.rs +12 -0
@@ 105,6 105,12 @@ fn retrofit() -> Result<()> {
                .long("hide-cursor")
                .help("Hides the terminal cursor, enabled by default when `baud` option is used"),
        )
        .arg(
            Arg::with_name("verbose")
                .short("v")
                .long("verbose")
                .help("Prints additional ANSI code information to the standard error stream"),
        )
        .get_matches();

    let width = value_t_or_exit!(matches, "width", u16);


@@ 128,6 134,7 @@ fn retrofit() -> Result<()> {

    let hide_cursor = baud.is_some() || matches.occurrences_of("hide-cursor") > 0;
    let ice_colors = matches.occurrences_of("ice-colors") > 0;
    let verbose = matches.occurrences_of("verbose") > 0;

    let target = match matches.value_of("output") {
        Some(filename) => {


@@ 151,6 158,11 @@ fn retrofit() -> Result<()> {
                .and_then_result(|escaped| {
                    escaped
                        .take_while(|code| !matches!(code, AnsiCode::ControlCharacter('\x1A')))
                        .inspect(|code| {
                            if verbose {
                                eprintln!("{:?}", code);
                            }
                        })
                        .adapt(
                            width,
                            height,