xous-core/services/shellchat/src/cmds/echo.rs
bunnie 2b66ab1db0 refactor to put commands in static storage
so that state can actually persist across multiple calls
2021-03-11 01:45:02 +08:00

26 lines
No EOL
503 B
Rust

use crate::{ShellCmdApi, CommonEnv};
use xous::String;
#[derive(Debug)]
pub struct Echo {
}
const VERB: &str = "echo";
impl<'a> ShellCmdApi<'a> for Echo {
fn matches(&self, verb: &str) -> bool {
if verb == VERB {
true
} else {
false
}
}
fn process(&mut self, rest: String::<1024>, _env: &mut CommonEnv) -> Result<Option<String::<1024>>, xous::Error> {
Ok(Some(rest))
}
fn verb(&self) -> &'static str {
VERB
}
}