tui: make slash command helpers exhaustive

Switch supports_inline_args() and requires_interaction() to exhaustive matches so newly added SlashCommand variants must be classified explicitly.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Charles Cunningham
2026-03-15 23:32:50 -07:00
co-authored by Codex
parent bb3e61843a
commit 217da0c113
+86 -26
View File
@@ -122,38 +122,98 @@ impl SlashCommand {
/// Whether this command supports inline args (for example `/model ...` or `/review ...`).
pub fn supports_inline_args(self) -> bool {
matches!(
self,
match self {
SlashCommand::Model
| SlashCommand::Review
| SlashCommand::Rename
| SlashCommand::Plan
| SlashCommand::Fast
| SlashCommand::SandboxReadRoot
)
| SlashCommand::Review
| SlashCommand::Rename
| SlashCommand::Plan
| SlashCommand::Fast
| SlashCommand::SandboxReadRoot => true,
SlashCommand::Approvals
| SlashCommand::Permissions
| SlashCommand::ElevateSandbox
| SlashCommand::Experimental
| SlashCommand::Skills
| SlashCommand::New
| SlashCommand::Resume
| SlashCommand::Fork
| SlashCommand::Init
| SlashCommand::Compact
| SlashCommand::Collab
| SlashCommand::Agent
| SlashCommand::Diff
| SlashCommand::Copy
| SlashCommand::Mention
| SlashCommand::Status
| SlashCommand::DebugConfig
| SlashCommand::Statusline
| SlashCommand::Theme
| SlashCommand::Mcp
| SlashCommand::Apps
| SlashCommand::Logout
| SlashCommand::Quit
| SlashCommand::Exit
| SlashCommand::Feedback
| SlashCommand::Rollout
| SlashCommand::Ps
| SlashCommand::Clean
| SlashCommand::Clear
| SlashCommand::Personality
| SlashCommand::Realtime
| SlashCommand::Settings
| SlashCommand::TestApproval
| SlashCommand::MultiAgents
| SlashCommand::MemoryDrop
| SlashCommand::MemoryUpdate => false,
}
}
/// Whether bare dispatch opens interactive UI that should be resolved before queueing.
pub fn requires_interaction(self) -> bool {
matches!(
self,
match self {
SlashCommand::Feedback
| SlashCommand::Resume
| SlashCommand::Review
| SlashCommand::Rename
| SlashCommand::Model
| SlashCommand::Settings
| SlashCommand::Personality
| SlashCommand::Collab
| SlashCommand::Agent
| SlashCommand::MultiAgents
| SlashCommand::Approvals
| SlashCommand::Permissions
| SlashCommand::Experimental
| SlashCommand::Skills
| SlashCommand::Statusline
| SlashCommand::Theme
)
| SlashCommand::Resume
| SlashCommand::Review
| SlashCommand::Rename
| SlashCommand::Model
| SlashCommand::Settings
| SlashCommand::Personality
| SlashCommand::Collab
| SlashCommand::Agent
| SlashCommand::MultiAgents
| SlashCommand::Approvals
| SlashCommand::Permissions
| SlashCommand::Experimental
| SlashCommand::Skills
| SlashCommand::Statusline
| SlashCommand::Theme => true,
SlashCommand::Fast
| SlashCommand::ElevateSandbox
| SlashCommand::SandboxReadRoot
| SlashCommand::New
| SlashCommand::Fork
| SlashCommand::Init
| SlashCommand::Compact
| SlashCommand::Plan
| SlashCommand::Diff
| SlashCommand::Copy
| SlashCommand::Mention
| SlashCommand::Status
| SlashCommand::DebugConfig
| SlashCommand::Mcp
| SlashCommand::Apps
| SlashCommand::Logout
| SlashCommand::Quit
| SlashCommand::Exit
| SlashCommand::Rollout
| SlashCommand::Ps
| SlashCommand::Clean
| SlashCommand::Clear
| SlashCommand::Realtime
| SlashCommand::TestApproval
| SlashCommand::MemoryDrop
| SlashCommand::MemoryUpdate => false,
}
}
/// Whether this command can be run while a task is in progress.