util-how 1.1.3

A program that takes your input and then goes through 4 sources to find quick help about usage.
use std::env::args;
use std::process::{Command, Stdio, exit};
use ureq;

fn main() {
    let mut argues: Vec<String> = args().skip(1).collect();

    if argues.len() < 1 {
        eprintln!("Missing arguement.");
        help();
        exit(1);
    }

    let mut flags = [false, false, false, false];

    for arg in &argues {
        match arg.as_str() {
            "-t" => flags[0] = true,

            "-c" => flags[1] = true,

            "-i" => flags[2] = true,

            "-m" => flags[3] = true,

            "-T" => {
                flags.fill(true);
                flags[0] = false;
            }

            "-C" => {
                flags.fill(true);
                flags[1] = false;
            }

            "-I" => {
                flags.fill(true);
                flags[2] = false;
            }

            "-M" => {
                flags.fill(true);
                flags[3] = false;
            }

            _ => break,
        }
    }
    argues.retain(|s| {
        !matches!(
            s.as_str(),
            "-t" | "-c" | "-i" | "-m" | "-T" | "-C" | "-I" | "-M"
        )
    });
    tldr(&flags, &argues);
}

fn tldr(flags: &[bool; 4], argues: &[String]) {
    if flags[0] != true {
        let result = Command::new("tldr")
            .args(argues)
            .stderr(Stdio::null())
            .status();

        match result {
            Ok(status) => {
                if status.success() {
                    exit(0);
                } else {
                    cheatsh(&flags, &argues);
                }
            }
            Err(_error) => {
                cheatsh(&flags, &argues);
            }
        }
    } else {
        cheatsh(&flags, &argues);
    }
}

fn cheatsh(flags: &[bool; 4], argues: &[String]) {
    if flags[1] != true {
        let links = argues.join("/");
        let domain = "https://cheat.sh/";
        let url = format!("{}{:?}", domain, links);

        let request = ureq::get(&url).header("User-Agent", "curl/7.81.0").call();

        match request {
            Ok(response) => {
                let text = response.into_body().read_to_string().unwrap();
                println!("{}", text);
            }

            Err(_error) => {
                infopage(&flags, &argues);
            }
        }
    } else {
        infopage(&flags, &argues);
    }
}

fn infopage(flags: &[bool; 4], argues: &[String]) {
    if flags[2] != true {
        let infopage = Command::new("info")
            .args(argues)
            .stderr(Stdio::null())
            .status();

        match infopage {
            Ok(status) => {
                if status.success() {
                    exit(0);
                } else {
                    manpage(&flags, &argues)
                }
            }
            Err(_error) => {
                manpage(&flags, &argues);
            }
        }
    } else {
        manpage(&flags, &argues);
    }
}

fn manpage(flags: &[bool; 4], argues: &[String]) {
    if flags[3] != true {
        let manpage = Command::new("man")
            .args(argues)
            .stderr(Stdio::null())
            .status();

        match manpage {
            Ok(status) => {
                if status.success() {
                    exit(1);
                } else {
                    if flags[3] != true {
                        println!(
                            "Nothing could be found. Check your internet connection, and reload tldr and man caches."
                        );
                    } else {
                        println!("Nothing found.");
                    }
                }
            }
            Err(_error) => {
                println!(
                    "Nothing could be found. Check your internet connection, and reload tldr and man caches."
                );
            }
        }
    } else {
        println!(
            "Nothing could be found. Check your internet connection, and reload tldr and man caches."
        );
    }
}

fn help() {
    println!("Semi useful rust utilities -- How");
    println!("Easily get knowledge for a specific command, from multiple sources.");
    println!("List of flags:");
    println!("-t     Remove tldr from the available sources.");
    println!("-c     Remove cheat.sh from the available sources.");
    println!("-i     Remove info from the available sources.");
    println!("-m     Remove man from the available sources.");
    println!("-T     Use only tldr for the sources.");
    println!("-C     Use only cheat.sh for the sources.");
    println!("-I     Use only info for the sources.");
    println!("-M     Use only man for the sources.");
}