-
Notifications
You must be signed in to change notification settings - Fork 132
refactor: add new state.prompt() function and simplify event handling #356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #356 +/- ##
==========================================
+ Coverage 87.50% 88.47% +0.97%
==========================================
Files 66 66
Lines 6537 6585 +48
==========================================
+ Hits 5720 5826 +106
+ Misses 817 759 -58 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This refactor introduces a new synchronous state.prompt() function and simplifies event handling throughout the codebase. Key changes include replacing callback‐based prompt logic with a synchronous prompt call, refactoring event handling to remove the GituEvent abstraction, and updating multiple ops to use the new prompt and confirmation APIs.
Reviewed Changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/tests/commit.rs | Updates function calls to use the new update API |
| src/term.rs | Adjusts the Test backend structure and adds poll_event/read_event methods |
| src/state.rs | Refactors event loop and prompt handling, adds new functions (prompt, confirm, etc.) |
| src/prompt.rs | Removes the outdated on_success callback from PromptData |
| src/ops/* | Updates prompt usage across various git operations |
| src/lib.rs | Removes unused GituEvent and simplifies run logic |
Comments suppressed due to low confidence (1)
src/term.rs:171
- Consider returning Ok(false) instead of an error when no events are available in the Test backend. This would align its behavior with the Crossterm branch and simplify handling in test scenarios.
TermBackend::Test { events, .. } => { if events.is_empty() { Err(Error::NoMoreEvents) } else { Ok(true) } },
aims to enable: #350, and simplify the already existing use-cases.
TODO: