[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>),
|
Shift(ShiftMode, Option<i32>),
|
||||||
Search(String),
|
Search(String),
|
||||||
Help,
|
Help,
|
||||||
|
Noop,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Command {
|
impl fmt::Display for Command {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let repr = match self {
|
let repr = match self {
|
||||||
|
Command::Noop => "noop".to_string(),
|
||||||
Command::Quit => "quit".to_string(),
|
Command::Quit => "quit".to_string(),
|
||||||
Command::TogglePlay => "playpause".to_string(),
|
Command::TogglePlay => "playpause".to_string(),
|
||||||
Command::Stop => "stop".to_string(),
|
Command::Stop => "stop".to_string(),
|
||||||
@@ -324,6 +326,7 @@ pub fn parse(input: &str) -> Option<Command> {
|
|||||||
"volup" => Some(Command::VolumeUp),
|
"volup" => Some(Command::VolumeUp),
|
||||||
"voldown" => Some(Command::VolumeDown),
|
"voldown" => Some(Command::VolumeDown),
|
||||||
"help" => Some(Command::Help),
|
"help" => Some(Command::Help),
|
||||||
|
"noop" => Some(Command::Noop),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ impl CommandManager {
|
|||||||
cmd: &Command,
|
cmd: &Command,
|
||||||
) -> Result<Option<String>, String> {
|
) -> Result<Option<String>, String> {
|
||||||
match cmd {
|
match cmd {
|
||||||
|
Command::Noop => Ok(None),
|
||||||
Command::Quit => {
|
Command::Quit => {
|
||||||
s.quit();
|
s.quit();
|
||||||
Ok(None)
|
Ok(None)
|
||||||
|
|||||||
Reference in New Issue
Block a user