fn tput_value(arg: &str) -> Option<u16> {
    let output = process::Command::new("tput").arg(arg).output().ok()?;
    let value = output
        .stdout
        .into_iter()
        .filter_map(|b| char::from(b).to_digit(10))
        .fold(0, |v, n| v * 10 + n as u16);

    if value > 0 {
        Some(value)
    } else {
        None
    }
}
/// execute tput with the given argument and parse
/// the output as a u16.
///
/// The arg should be "cols" or "lines"
execute tput with the given argument and parse
the output as a u16.

The arg should be "cols" or "lines"
execute tput with the given argument and parse the output as a u16 . The arg should be " cols " or " lines "
fn tput_value(arg: &str) -> Option<u16> {
    let output = process::Command::new("tput").arg(arg).output().ok()?;
    let value = output
        .stdout
        .into_iter()
        .filter_map(|b| char::from(b).to_digit(10))
        .fold(0, |v, n| v * 10 + n as u16);
    if value > 0 {
        Some(value)
    } else {
        None
    }
}
fn tput_value ( arg : & str ) -> Option < u16 > { let output = process :: Command :: new ( " " ) . arg ( arg ) . output ( ) . ok ( ) ? ; let value = output . stdout . into_iter ( ) . filter_map ( | b | char :: from ( b ) . to_digit ( 10 ) ) . fold ( 0 , | v , n | v * 10 + n as u16 ) ; if value > 0 { Some ( value ) } else { None } }
execute tput with the given argument and parse
the output as a u16.
execute tput with the given argument and parse the output as a u16 .
arg
&str
arg
&str