modcli/commands/ping.rs
1use crate::command::Command;
2
3pub struct PingCommand;
4
5impl Command for PingCommand {
6 fn name(&self) -> &'static str {
7 "ping"
8 }
9
10 fn help(&self) -> Option<&str> {
11 Some("Responds with pong")
12 }
13
14 fn validate(&self, args: &[String]) -> Result<(), String> {
15 if !args.is_empty() {
16 Err("Ping does not accept any arguments.".into())
17 } else {
18 Ok(())
19 }
20 }
21
22 fn execute(&self, _args: &[String]) {
23 println!("Pong!");
24 }
25}