fn command(&mut self, mut command: &str) -> Result<bool, Error> {
        // Remove any whitespaces in either ends.
        command = command.trim();
        // Do the respective action.
        match command {
            // View a card.
            "view" | "v" => self.view_card()?,
            // Review: fail.
            "fail" | "f" => self.review(backend::Score::Fail)?,
            // Review: hard.
            "hard" | "h" => self.review(backend::Score::Hard)?,
            // Review: okay.
            "okay" | "o" => self.review(backend::Score::Okay)?,
            // Review: good.
            "good" | "g" => self.review(backend::Score::Good)?,
            // Review: easy.
            "easy" | "e" => self.review(backend::Score::Easy)?,
            // Skip the card.
            "skip" | "s" => self.skip()?,
            // Print card information.
            "info" | "i" => self.print_info()?,
            // Print metadata of the card.
            "meta" | "m" => self.print_meta()?,
            // Print history of the card.
            "hist" | "hi" => self.print_history()?,
            // Print tag statistics.
            "tags" | "tg" => self.print_tag_statistics()?,
            // Quit the program.
            "quit" | "q" => return Ok(false),
            // Print help screen.
            "help" | "he" => self.help()?,
            // Toggle preference for new cards.
            "tnew" | "tn" => self.scheduler.prefer_new ^= true,
            // Skip.
            "" => (),
            // Unknown command.
            _ => writeln!(self.stdout, "Unknown command '{}'.", command)?,
        }

        // The program will continue.
        Ok(true)
    }
/// Run command `command`.
///
/// The returned boolean is false precisely when the program should quit.
Run command `command`.
The returned boolean is false precisely when the program should quit.
Run command ` command ` . The returned boolean is false precisely when the program should quit .
fn command(&mut self, mut command: &str) -> Result<bool, Error> {
        // Remove any whitespaces in either ends.
        command = command.trim();
        // Do the respective action.
        match command {
            // View a card.
            "view" | "v" => self.view_card()?,
            // Review: fail.
            "fail" | "f" => self.review(backend::Score::Fail)?,
            // Review: hard.
            "hard" | "h" => self.review(backend::Score::Hard)?,
            // Review: okay.
            "okay" | "o" => self.review(backend::Score::Okay)?,
            // Review: good.
            "good" | "g" => self.review(backend::Score::Good)?,
            // Review: easy.
            "easy" | "e" => self.review(backend::Score::Easy)?,
            // Skip the card.
            "skip" | "s" => self.skip()?,
            // Print card information.
            "info" | "i" => self.print_info()?,
            // Print metadata of the card.
            "meta" | "m" => self.print_meta()?,
            // Print history of the card.
            "hist" | "hi" => self.print_history()?,
            // Print tag statistics.
            "tags" | "tg" => self.print_tag_statistics()?,
            // Quit the program.
            "quit" | "q" => return Ok(false),
            // Print help screen.
            "help" | "he" => self.help()?,
            // Toggle preference for new cards.
            "tnew" | "tn" => self.scheduler.prefer_new ^= true,
            // Skip.
            "" => (),
            // Unknown command.
            _ => writeln!(self.stdout, "Unknown command '{}'.", command)?,
        }
        // The program will continue.
        Ok(true)
    }
fn command ( & mut self , mut command : & str ) -> Result < bool , Error > { // Remove any whitespaces in either ends. command = command . trim ( ) ; // Do the respective action. match command { // View a card. " " | " " => self . view_card ( ) ? , // Review: fail. " " | " " => self . review ( backend :: Score :: Fail ) ? , // Review: hard. " " | " " => self . review ( backend :: Score :: Hard ) ? , // Review: okay. " " | " " => self . review ( backend :: Score :: Okay ) ? , // Review: good. " " | " " => self . review ( backend :: Score :: Good ) ? , // Review: easy. " " | " " => self . review ( backend :: Score :: Easy ) ? , // Skip the card. " " | " " => self . skip ( ) ? , // Print card information. " " | " " => self . print_info ( ) ? , // Print metadata of the card. " " | " " => self . print_meta ( ) ? , // Print history of the card. " " | " " => self . print_history ( ) ? , // Print tag statistics. " " | " " => self . print_tag_statistics ( ) ? , // Quit the program. " " | " " => return Ok ( false ) , // Print help screen. " " | " " => self . help ( ) ? , // Toggle preference for new cards. " " | " " => self . scheduler . prefer_new ^= true , // Skip. " " => ( ) , // Unknown command. _ => writeln ! ( self stdout " " command ) ? , } // The program will continue. Ok ( true ) }
Run command `command`.
Run command ` command ` .
&mut self
command
&str
&mut self
command
&str