🧹 [Simplify interactive CLI menu function]#178
Conversation
Extracted the interactive action error-handling logic from the central `match` block in `src/cli/mod.rs` into 8 dedicated async helper functions (`handle_create_user`, `handle_change_password`, etc.). This dramatically reduces the vertical length of the `run` function and improves readability without altering functionality. Co-authored-by: ffalcinelli <1167082+ffalcinelli@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #178 +/- ##
==========================================
+ Coverage 96.13% 96.42% +0.29%
==========================================
Files 29 29
Lines 2925 2941 +16
==========================================
+ Hits 2812 2836 +24
+ Misses 113 105 -8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Extracted the interactive action error-handling logic from the central `match` block in `src/cli/mod.rs` into 8 dedicated async helper functions (`handle_create_user`, `handle_change_password`, etc.). This dramatically reduces the vertical length of the `run` function and improves readability without altering functionality. Added a new unit test `test_cli_errors_hit` to ensure coverage targets are met. Co-authored-by: ffalcinelli <1167082+ffalcinelli@users.noreply.github.com>
Added unit tests to hit the extracted handler error paths, `prompt_realm` fallback branch, and `get_realms` filter branches in `cli_interactive_test.rs` to satisfy coverage metrics. Co-authored-by: ffalcinelli <1167082+ffalcinelli@users.noreply.github.com>
🎯 What: Extracted the error-handling logic from the
matchblock insrc/cli/mod.rsinto 8 separatehandle_*async functions.💡 Why: The
runfunction was vertically long and cluttered with repetitive error-handling boilerplate. Moving this logic to dedicated helper functions significantly improves code maintainability and readability while preserving the exact behavior.✅ Verification: Verified that the refactored code compiles cleanly (
cargo check) and passes all unit and integration tests (cargo test), ensuring no functionality was broken or regressions introduced.✨ Result: The
runfunction'smatchblock is now clean and concise, strictly mapping selections to their respective handler functions.PR created automatically by Jules for task 18032350460419519051 started by @ffalcinelli