feat(tui): easily retry failed commands#12926
Merged
davidpdrsn merged 1 commit intomasterfrom Mar 19, 2026
Merged
Conversation
If you ran a command in the TUI, and it failed, it would be discarded. That made it tedious to retry. This fixes that so if the command failed you stay in command mode with the previous command in the input. That way you can easily tweak it and try again.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the but legacy status TUI command mode UX by keeping the user in command mode (with the previous command preserved) when a command fails, making it easy to tweak and retry.
Changes:
- Update command execution flow to only return to normal mode on success; on failure, show a transient error and keep command input intact.
- Add a focused test module for command mode behavior and new snapshots covering success and failure scenarios.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/but/src/command/legacy/status/tui/mod.rs | Keep command mode active on non-zero exit and show a transient error; factor out prompt + exit-status formatting. |
| crates/but/src/command/legacy/status/tui/tests/mod.rs | Register new command_tests module. |
| crates/but/src/command/legacy/status/tui/tests/command_tests.rs | Add tests asserting command-mode success returns to normal and failures preserve the input. |
| crates/but/src/command/legacy/status/tui/tests/snapshots/command_mode_success_001.txt | Snapshot: entering command mode with initial input. |
| crates/but/src/command/legacy/status/tui/tests/snapshots/command_mode_success_002.txt | Snapshot: command mode with typed args. |
| crates/but/src/command/legacy/status/tui/tests/snapshots/command_mode_success_003.txt | Snapshot: post-success returns to normal mode. |
| crates/but/src/command/legacy/status/tui/tests/snapshots/command_mode_failure_001.txt | Snapshot: non-zero exit shows error popup while retaining command input. |
You can also share your feedback on Copilot code review. Take the survey.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If you ran a command in the TUI, and it failed, it would be discarded.
That made it tedious to retry.
This fixes that so if the command failed you stay in command mode with
the previous command in the input. That way you can easily tweak it and
try again.
Note
This pull request is part of a stack: