Repository navigation
fix(cli): reject an unknown --device name - #728
Conversation
An unmatched --device name used to fall through and keep the saved device. Resolve the name first and return the same error --transfer already uses.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe CLI now resolves requested device names to IDs and reports an error when no exact match has an ID. Both ChangesCLI device-name lookup
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The device-name lookup appears to meet the stated behavior; no merge-blocking issue is identified. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
I appreciate the quick approval and merge, LargeModGames.
Sharing Genuinely fun to trace, and I learned a lot from how those two commands had drifted! |
# Summary Adds @mvanhorn, @devtechedge, @montionugera, @psymariux, @uznog and @zaydmulani09 to the contributor list for code, for #857, #728, #729, #893, #536, #677 and #592. One PR for all six, so the entries do not conflict with each other the way separate bot PRs do. # Testing - `npx [email protected] add <login> code` for each login, which also regenerated the README table. # Additional notes Replaces #918, #919 and the other bot PRs from the requests on #872. --- <sub>💬 Questions or want to chat with other contributors? Join the [spotatui Discord](https://spotatui.com/discord).</sub>
--devicewith a name that matches nothing used to keep going.set_devicewrote an id only on an exact match, then returned success, so a typo or an empty device list still played on the saved device.--transferalready stopped withno device with name '…'and a non-zero exit.--devicenow does that before any playback command runs.device_id_by_namereturns the id of the first device with that exact name. It errors when nothing matches, the list is empty, or that device has no id. Ifdevices()isNone, the oldno device availableerror is unchanged.The old loop had no
break, so two devices with the same name kept the last id. The helper keeps the first.--transferalready stopped at the first match, and it now uses this helper so both paths share the message.The tests call the helper only. They never build a
CliApp, becauseset_device_idwrites the realclient.yml.a_device_name_resolves_to_its_idan_unknown_device_name_is_an_errora_device_name_with_no_id_is_an_errora_device_name_with_no_devices_is_an_errorChecked locally:
cargo test --no-default-features --features telemetry,tui device_name: 4 passed, 1457 filtered outcargo fmt --all -- --checkcargo clippy --no-default-features --features telemetry,tui -- -D warningscargo test --no-default-features --features telemetry,tui: 1461 passed, 0 failedFixes #669
Summary by CodeRabbit
playandplaybackcommands now report an error and exit with a non-zero status when the requested Connect device cannot be found, instead of continuing on the saved device.