[feat] add Command::Noop
This commit is contained in:
committed by
Henrik Friedrichsen
parent
d2eede2777
commit
0f08a56f90
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ impl CommandManager {
|
||||
cmd: &Command,
|
||||
) -> Result<Option<String>, String> {
|
||||
match cmd {
|
||||
Command::Noop => Ok(None),
|
||||
Command::Quit => {
|
||||
s.quit();
|
||||
Ok(None)
|
||||
|
||||
Reference in New Issue
Block a user