pub fn command<S: Display>(s: S) -> Result<(), String> {
        // Trim extraneous semicolons, bash / sh doesnt like it one bit!
        let s = s.to_string().trim_end_matches(";").to_string();
        match Self::get() {
            // Run a command on CMD
            Platform::Windows => {
                match Command::new("cmd").args(&["/C", &format!("{}", s)]).output() {
                    Ok(_) => Ok(()),
                    Err(_) => Err(format!("Failed to run Windows command '{}'", s))
                }
            },

            // Run a command on bash
            Platform::MacOS => {
                match Command::new("bash").args(&["-c", &format!("{}", s)]).output() {
                    Ok(_) => Ok(()),
                    Err(_) => Err(format!("Failed to run MacOS command '{}'", s))
                }
            },
            // Run a command on bash
            Platform::Ubuntu => {
                match Command::new("bash").args(&["-c", &format!("{}", s)]).output() {
                    Ok(_) => Ok(()),
                    Err(_) => Err(format!("Failed to run Ubuntu command '{}'", s))
                }
            },
            // Because it's not known if `Unknown` has bash, use more widespread sh shell.
            Platform::Unknown => {
                match Command::new("sh").args(&["-c", &format!("{}", s)]).output() {
                    Ok(_) => Ok(()),
                    Err(_) => Err(format!("Failed to run Linux command '{}'", s))
                }
            }
        }
    }
/// This function writes a command the operating system's respective
/// command line shell.
/// 
/// For now, there is a bug with error detection. Because Im calling
/// bash / sh with a string containing the script instruction to run, 
/// the stderr doesnt get processed properly by std::process::Command.
/// 
/// I will try to fix this bug in the future because its causing the program
/// to continue as if its succeeding, even if its hit a catastrophic failure.
This function writes a command the operating system's respective
command line shell.

For now, there is a bug with error detection. Because Im calling
bash / sh with a string containing the script instruction to run,
the stderr doesnt get processed properly by std::process::Command.

I will try to fix this bug in the future because its causing the program
to continue as if its succeeding, even if its hit a catastrophic failure.
This function writes a command the operating system ' s respective command line shell . For now there is a bug with error detection . Because Im calling bash / sh with a string containing the script instruction to run the stderr doesnt get processed properly by std :: process :: Command . I will try to fix this bug in the future because its causing the program to continue as if its succeeding even if its hit a catastrophic failure .
pub fn command<S: Display>(s: S) -> Result<(), String> {
        // Trim extraneous semicolons, bash / sh doesnt like it one bit!
        let s = s.to_string().trim_end_matches(";").to_string();
        match Self::get() {
            // Run a command on CMD
            Platform::Windows => {
                match Command::new("cmd").args(&["/C", &format!("{}", s)]).output() {
                    Ok(_) => Ok(()),
                    Err(_) => Err(format!("Failed to run Windows command '{}'", s))
                }
            },
            // Run a command on bash
            Platform::MacOS => {
                match Command::new("bash").args(&["-c", &format!("{}", s)]).output() {
                    Ok(_) => Ok(()),
                    Err(_) => Err(format!("Failed to run MacOS command '{}'", s))
                }
            },
            // Run a command on bash
            Platform::Ubuntu => {
                match Command::new("bash").args(&["-c", &format!("{}", s)]).output() {
                    Ok(_) => Ok(()),
                    Err(_) => Err(format!("Failed to run Ubuntu command '{}'", s))
                }
            },
            // Because it's not known if `Unknown` has bash, use more widespread sh shell.
            Platform::Unknown => {
                match Command::new("sh").args(&["-c", &format!("{}", s)]).output() {
                    Ok(_) => Ok(()),
                    Err(_) => Err(format!("Failed to run Linux command '{}'", s))
                }
            }
        }
    }
pub fn command < S : Display > ( s : S ) -> Result < ( ) , String > { // Trim extraneous semicolons, bash / sh doesnt like it one bit! let s = s . to_string ( ) . trim_end_matches ( " " ) . to_string ( ) ; match Self :: get ( ) { // Run a command on CMD Platform :: Windows => { match Command :: new ( " " ) . args ( & [ " " , & format ! ( " " s ) ] ) . output ( ) { Ok ( _ ) => Ok ( ( ) ) , Err ( _ ) => Err ( format ! ( " " s ) ) } } , // Run a command on bash Platform :: MacOS => { match Command :: new ( " " ) . args ( & [ " " , & format ! ( " " s ) ] ) . output ( ) { Ok ( _ ) => Ok ( ( ) ) , Err ( _ ) => Err ( format ! ( " " s ) ) } } , // Run a command on bash Platform :: Ubuntu => { match Command :: new ( " " ) . args ( & [ " " , & format ! ( " " s ) ] ) . output ( ) { Ok ( _ ) => Ok ( ( ) ) , Err ( _ ) => Err ( format ! ( " " s ) ) } } , // Because it's not known if `Unknown` has bash, use more widespread sh shell. Platform :: Unknown => { match Command :: new ( " " ) . args ( & [ " " , & format ! ( " " s ) ] ) . output ( ) { Ok ( _ ) => Ok ( ( ) ) , Err ( _ ) => Err ( format ! ( " " s ) ) } } } }
This function writes a command the operating system's respective
command line shell.
This function writes a command the operating system ' s respective command line shell .
s
S
s
S