pub fn status_colorizer(status: &str) -> String {
    match status.chars().next() {
        Some('1') => style(status).blue().to_string(), // informational
        Some('2') => style(status).green().to_string(), // success
        Some('3') => style(status).yellow().to_string(), // redirects
        Some('4') => style(status).red().to_string(),  // client error
        Some('5') => style(status).red().to_string(),  // server error
        Some('W') => style(status).cyan().to_string(), // wildcard
        Some('E') => style(status).red().to_string(),  // error
        _ => status.to_string(),                       // ¯\_(ツ)_/¯
    }
}
/// Takes in a string and examines the first character to return a color version of the same string
Takes in a string and examines the first character to return a color version of the same string
Takes in a string and examines the first character to return a color version of the same string
pub fn status_colorizer(status: &str) -> String {
    match status.chars().next() {
        Some('1') => style(status).blue().to_string(), // informational
        Some('2') => style(status).green().to_string(), // success
        Some('3') => style(status).yellow().to_string(), // redirects
        Some('4') => style(status).red().to_string(),  // client error
        Some('5') => style(status).red().to_string(),  // server error
        Some('W') => style(status).cyan().to_string(), // wildcard
        Some('E') => style(status).red().to_string(),  // error
        _ => status.to_string(),                       // ¯\_(ツ)_/¯
    }
}
pub fn status_colorizer ( status : & str ) -> String { match status . chars ( ) . next ( ) { Some ( '1' ) => style ( status ) . blue ( ) . to_string ( ) , // informational Some ( '2' ) => style ( status ) . green ( ) . to_string ( ) , // success Some ( '3' ) => style ( status ) . yellow ( ) . to_string ( ) , // redirects Some ( '4' ) => style ( status ) . red ( ) . to_string ( ) , // client error Some ( '5' ) => style ( status ) . red ( ) . to_string ( ) , // server error Some ( 'W' ) => style ( status ) . cyan ( ) . to_string ( ) , // wildcard Some ( 'E' ) => style ( status ) . red ( ) . to_string ( ) , // error _ => status . to_string ( ) , // ¯\_(ツ)_/¯ } }
Takes in a string and examines the first character to return a color version of the same string
Takes in a string and examines the first character to return a color version of the same string
status
&str