add list
This commit is contained in:
parent
db4f7f9369
commit
37e89d6dc5
3 changed files with 26 additions and 1 deletions
20
src/command/list.rs
Normal file
20
src/command/list.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
#[derive(Default)]
|
||||||
|
pub struct ListCommand {
|
||||||
|
uuids: bool
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ListCommand {
|
||||||
|
pub fn uuids(mut self) -> Self {
|
||||||
|
self.uuids = true;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn build(self) -> super::Command {
|
||||||
|
let uuids = self.uuids;
|
||||||
|
let mut s = format!("list");
|
||||||
|
if uuids {
|
||||||
|
s.push_str(" uuids");
|
||||||
|
}
|
||||||
|
super::Command(s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
pub struct Command(String);
|
pub struct Command(String);
|
||||||
|
|
||||||
mod say;
|
mod say;
|
||||||
|
mod list;
|
||||||
|
|
||||||
impl Command {
|
impl Command {
|
||||||
pub fn raw(cmd: &str) -> Self {
|
pub fn raw(cmd: &str) -> Self {
|
||||||
|
|
@ -14,4 +15,8 @@ impl Command {
|
||||||
pub fn say() -> say::SayCommand {
|
pub fn say() -> say::SayCommand {
|
||||||
say::SayCommand::default()
|
say::SayCommand::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn list() -> list::ListCommand {
|
||||||
|
list::ListCommand::default()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -10,7 +10,7 @@ impl SayCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build(self) -> super::Command {
|
pub fn build(self) -> super::Command {
|
||||||
let message= self.message;
|
let message = self.message;
|
||||||
let s = format!("say {message}");
|
let s = format!("say {message}");
|
||||||
super::Command(s)
|
super::Command(s)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue