implement logout command

fixes #470
This commit is contained in:
Henrik Friedrichsen
2021-03-22 21:56:22 +01:00
parent 5f87e3cd79
commit a0231362f1
3 changed files with 22 additions and 0 deletions

View File

@@ -134,6 +134,7 @@ pub enum Command {
Insert(Option<String>),
NewPlaylist(String),
Sort(SortKey, SortDirection),
Logout,
}
impl fmt::Display for Command {
@@ -192,6 +193,7 @@ impl fmt::Display for Command {
Command::Insert(_) => "insert".to_string(),
Command::NewPlaylist(name) => format!("new playlist {}", name),
Command::Sort(key, direction) => format!("sort {} {}", key, direction),
Command::Logout => "logout".to_string(),
};
write!(f, "{}", repr)
}
@@ -415,6 +417,7 @@ pub fn parse(input: &str) -> Option<Command> {
None
}
}
"logout" => Some(Command::Logout),
"noop" => Some(Command::Noop),
_ => None,
}