Skip to content

Commit 8520605

Browse files
charley-oaicodex
andcommitted
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>
1 parent 46db599 commit 8520605

File tree

1 file changed

+86
-26
lines changed

1 file changed

+86
-26
lines changed

codex-rs/tui/src/slash_command.rs

Lines changed: 86 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -120,38 +120,98 @@ impl SlashCommand {
120120

121121
/// Whether this command supports inline args (for example `/model ...` or `/review ...`).
122122
pub fn supports_inline_args(self) -> bool {
123-
matches!(
124-
self,
123+
match self {
125124
SlashCommand::Model
126-
| SlashCommand::Review
127-
| SlashCommand::Rename
128-
| SlashCommand::Plan
129-
| SlashCommand::Fast
130-
| SlashCommand::SandboxReadRoot
131-
)
125+
| SlashCommand::Review
126+
| SlashCommand::Rename
127+
| SlashCommand::Plan
128+
| SlashCommand::Fast
129+
| SlashCommand::SandboxReadRoot => true,
130+
SlashCommand::Approvals
131+
| SlashCommand::Permissions
132+
| SlashCommand::ElevateSandbox
133+
| SlashCommand::Experimental
134+
| SlashCommand::Skills
135+
| SlashCommand::New
136+
| SlashCommand::Resume
137+
| SlashCommand::Fork
138+
| SlashCommand::Init
139+
| SlashCommand::Compact
140+
| SlashCommand::Collab
141+
| SlashCommand::Agent
142+
| SlashCommand::Diff
143+
| SlashCommand::Copy
144+
| SlashCommand::Mention
145+
| SlashCommand::Status
146+
| SlashCommand::DebugConfig
147+
| SlashCommand::Statusline
148+
| SlashCommand::Theme
149+
| SlashCommand::Mcp
150+
| SlashCommand::Apps
151+
| SlashCommand::Logout
152+
| SlashCommand::Quit
153+
| SlashCommand::Exit
154+
| SlashCommand::Feedback
155+
| SlashCommand::Rollout
156+
| SlashCommand::Ps
157+
| SlashCommand::Clean
158+
| SlashCommand::Clear
159+
| SlashCommand::Personality
160+
| SlashCommand::Realtime
161+
| SlashCommand::Settings
162+
| SlashCommand::TestApproval
163+
| SlashCommand::MultiAgents
164+
| SlashCommand::MemoryDrop
165+
| SlashCommand::MemoryUpdate => false,
166+
}
132167
}
133168

134169
/// Whether bare dispatch opens interactive UI that should be resolved before queueing.
135170
pub fn requires_interaction(self) -> bool {
136-
matches!(
137-
self,
171+
match self {
138172
SlashCommand::Feedback
139-
| SlashCommand::Resume
140-
| SlashCommand::Review
141-
| SlashCommand::Rename
142-
| SlashCommand::Model
143-
| SlashCommand::Settings
144-
| SlashCommand::Personality
145-
| SlashCommand::Collab
146-
| SlashCommand::Agent
147-
| SlashCommand::MultiAgents
148-
| SlashCommand::Approvals
149-
| SlashCommand::Permissions
150-
| SlashCommand::Experimental
151-
| SlashCommand::Skills
152-
| SlashCommand::Statusline
153-
| SlashCommand::Theme
154-
)
173+
| SlashCommand::Resume
174+
| SlashCommand::Review
175+
| SlashCommand::Rename
176+
| SlashCommand::Model
177+
| SlashCommand::Settings
178+
| SlashCommand::Personality
179+
| SlashCommand::Collab
180+
| SlashCommand::Agent
181+
| SlashCommand::MultiAgents
182+
| SlashCommand::Approvals
183+
| SlashCommand::Permissions
184+
| SlashCommand::Experimental
185+
| SlashCommand::Skills
186+
| SlashCommand::Statusline
187+
| SlashCommand::Theme => true,
188+
SlashCommand::Fast
189+
| SlashCommand::ElevateSandbox
190+
| SlashCommand::SandboxReadRoot
191+
| SlashCommand::New
192+
| SlashCommand::Fork
193+
| SlashCommand::Init
194+
| SlashCommand::Compact
195+
| SlashCommand::Plan
196+
| SlashCommand::Diff
197+
| SlashCommand::Copy
198+
| SlashCommand::Mention
199+
| SlashCommand::Status
200+
| SlashCommand::DebugConfig
201+
| SlashCommand::Mcp
202+
| SlashCommand::Apps
203+
| SlashCommand::Logout
204+
| SlashCommand::Quit
205+
| SlashCommand::Exit
206+
| SlashCommand::Rollout
207+
| SlashCommand::Ps
208+
| SlashCommand::Clean
209+
| SlashCommand::Clear
210+
| SlashCommand::Realtime
211+
| SlashCommand::TestApproval
212+
| SlashCommand::MemoryDrop
213+
| SlashCommand::MemoryUpdate => false,
214+
}
155215
}
156216

157217
/// Whether this command can be run while a task is in progress.

0 commit comments

Comments
 (0)