p2p_chat/ui/runner/actions/commands/
mod.rs1mod friends;
5mod history;
6mod info;
7mod peers;
8mod send;
9
10use anyhow::Result;
11
12use super::context::CommandContext;
13
14pub async fn dispatch(parts: &[&str], context: &CommandContext) -> Result<()> {
28 match parts[0] {
29 "send" => send::handle_send(parts, context).await,
30 "friend" => friends::add_friend(parts, context).await,
31 "friends" => friends::list_friends(context).await,
32 "history" => history::show_history(parts, context).await,
33 "peers" => peers::list_peers(context).await,
34 "info" => info::show_info(context).await,
35 "check" => info::show_check_message(context).await,
36 "help" => info::show_help(context).await,
37 "exit" => Ok(()),
38 _ => {
39 context.emit_chat(format!(
40 "❌ Unknown command: {}. Type 'help' for available commands.",
41 parts[0]
42 ));
43 Ok(())
44 }
45 }
46}