in poc/src/commands.rs [94:115]
fn handle_dir_cmd(command: &str, parts: Vec<&str>, full_text: &str) -> Command {
let dir_cmd: Option<Option<DirectoryCommand>> = match command {
"publish" => Some(Command::publish(parts)),
"lookup" => Some(Command::lookup(parts)),
"history" => Some(Command::history(parts)),
"audit" => Some(Command::audit(parts)),
"root" | "root_hash" => Some(Command::root_hash(parts)),
_ => None,
};
match dir_cmd {
Some(Some(cmd)) => Command::Directory(cmd),
Some(None) => {
let msg = format!(
"Command {} received invalid argments. Check {} for syntax",
command,
"help".green()
);
Command::InvalidArgs(msg)
}
_ => Command::Unknown(String::from(full_text)),
}
}