[feat] add Command::Noop

This commit is contained in:
Henry Snopek
2020-06-24 21:53:15 -05:00
committed by Henrik Friedrichsen
parent d2eede2777
commit 0f08a56f90
2 changed files with 4 additions and 0 deletions

View File

@@ -102,11 +102,13 @@ pub enum Command {
Shift(ShiftMode, Option<i32>),
Search(String),
Help,
Noop,
}
impl fmt::Display for Command {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let repr = match self {
Command::Noop => "noop".to_string(),
Command::Quit => "quit".to_string(),
Command::TogglePlay => "playpause".to_string(),
Command::Stop => "stop".to_string(),
@@ -324,6 +326,7 @@ pub fn parse(input: &str) -> Option<Command> {
"volup" => Some(Command::VolumeUp),
"voldown" => Some(Command::VolumeDown),
"help" => Some(Command::Help),
"noop" => Some(Command::Noop),
_ => None,
}
}

View File

@@ -83,6 +83,7 @@ impl CommandManager {
cmd: &Command,
) -> Result<Option<String>, String> {
match cmd {
Command::Noop => Ok(None),
Command::Quit => {
s.quit();
Ok(None)