17 lines
No EOL
410 B
Rust
17 lines
No EOL
410 B
Rust
#[derive(Default)]
|
|
pub struct SayCommand {
|
|
message: Option<String>
|
|
}
|
|
|
|
impl SayCommand {
|
|
pub fn message(mut self, msg: impl Into<String>) -> Self {
|
|
self.message = Some(msg.into());
|
|
self
|
|
}
|
|
|
|
pub fn build(self) -> super::Command {
|
|
let message = self.message.unwrap_or("Hello, world!".to_string());
|
|
let s = format!("say {message}");
|
|
super::Command(s)
|
|
}
|
|
} |