Add centralized argument parsing and usage responses for bright and todo commands #711
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.
Motivation
Description
src/common/command.rswithparse_argsandParseArgsResultto returnParsed(T)orUsage(String)and expose it viasrc/common/mod.rsascommand.parse_argsand return a usageAction(label starts withUsage: bright) for partial/invalid inputs while still returning the dialog action for emptybrightinput.parse_argsforadd,pset,tag,rmand to return usageActions (labels likeUsage: todo ...) for empty/invalid input while retaining zero-arg dialog/view actions.tests/brightness_plugin.rsandtests/todo_plugin.rsto validate usage responses and fuzz-ish partial queries such as"br","bright", and"todo !"do not panic and surface helpful usage output.Testing
cargo test --test brightness_plugin --test todo_pluginto execute the modified tests, but the build failed with a dependency build error caused by a missing system library (alsa/alsa-sys), so the test run did not complete successfully.cargo fmtwas run as part of the rollout to format changes (no test assertion impact).Codex Task