agent_core/tui/commands/result.rs
1//! Command execution result type.
2
3/// Result of executing a slash command.
4#[derive(Debug, Clone)]
5pub enum CommandResult {
6 /// Command succeeded, no message to display.
7 Ok,
8
9 /// Command succeeded, display this message in the conversation.
10 Message(String),
11
12 /// Command failed with an error message.
13 Error(String),
14
15 /// Command requests the application to quit.
16 Quit,
17
18 /// Command handled its own UI (e.g., opened a picker).
19 /// App should not display any additional message.
20 Handled,
21}
22
23impl CommandResult {
24 /// Create a success result with a message.
25 pub fn message(msg: impl Into<String>) -> Self {
26 Self::Message(msg.into())
27 }
28
29 /// Create an error result.
30 pub fn error(msg: impl Into<String>) -> Self {
31 Self::Error(msg.into())
32 }
33}