pub fn handle_input(&self, input: String) {
        let mut tokens = input.trim().split_whitespace();
        let command_name_wrapped = tokens.nth(0);

        if command_name_wrapped.is_some() {
            //Parse the command's name
            let command_name = command_name_wrapped.unwrap().trim().to_lowercase();
            //Get the command if it is a known command
            let target_command = self.known_commands.get(&command_name);

            if target_command.is_some() {
                let command = target_command.unwrap();
                let found_flags: Option<HashMap<String, String>> = self.parse_flags(tokens);
                if found_flags.is_some() {
                    //We have our flags parsed, the command has been found and are ready to execute the command
                    let flags = found_flags.unwrap();
                    if self.verify_flags(&flags, command.get_information().flags) {
                        command.execute_command(flags);
                    }
                }
            }
            else {
                println!("Failed to find the target command: {}", command_name);
            }
        }
        else {
            println!("Expected a command name");
        }
    }
///Takes in a user's command input and parses and executes the command if everything is in order.
Takes in a user's command input and parses and executes the command if everything is in order.
Takes in a user ' s command input and parses and executes the command if everything is in order .
pub fn handle_input(&self, input: String) {
        let mut tokens = input.trim().split_whitespace();
        let command_name_wrapped = tokens.nth(0);
        if command_name_wrapped.is_some() {
            //Parse the command's name
            let command_name = command_name_wrapped.unwrap().trim().to_lowercase();
            //Get the command if it is a known command
            let target_command = self.known_commands.get(&command_name);
            if target_command.is_some() {
                let command = target_command.unwrap();
                let found_flags: Option<HashMap<String, String>> = self.parse_flags(tokens);
                if found_flags.is_some() {
                    //We have our flags parsed, the command has been found and are ready to execute the command
                    let flags = found_flags.unwrap();
                    if self.verify_flags(&flags, command.get_information().flags) {
                        command.execute_command(flags);
                    }
                }
            }
            else {
                println!("Failed to find the target command: {}", command_name);
            }
        }
        else {
            println!("Expected a command name");
        }
    }
pub fn handle_input ( & self , input : String ) { let mut tokens = input . trim ( ) . split_whitespace ( ) ; let command_name_wrapped = tokens . nth ( 0 ) ; if command_name_wrapped . is_some ( ) { //Parse the command's name let command_name = command_name_wrapped . unwrap ( ) . trim ( ) . to_lowercase ( ) ; //Get the command if it is a known command let target_command = self . known_commands . get ( & command_name ) ; if target_command . is_some ( ) { let command = target_command . unwrap ( ) ; let found_flags : Option < HashMap < String , String > > = self . parse_flags ( tokens ) ; if found_flags . is_some ( ) { //We have our flags parsed, the command has been found and are ready to execute the command let flags = found_flags . unwrap ( ) ; if self . verify_flags ( & flags , command . get_information ( ) . flags ) { command . execute_command ( flags ) ; } } } else { println ! ( " " command_name ) ; } } else { println ! ( " " ) ; } }
Takes in a user's command input and parses and executes the command if everything is in order.
Takes in a user ' s command input and parses and executes the command if everything is in order .
&self
input
String
&self
input
String