Skip to content

Conversation

@multiplex55
Copy link
Owner

Motivation

  • Provide a centralized, non-panicking argument parsing helper that returns either parsed values or a usage string so command plugins can present helpful guidance on empty/invalid input.
  • Ensure commands expose a safe zero-arg path (open dialog/view) while also surfacing usage text for partial or malformed queries.

Description

  • Add src/common/command.rs with parse_args and ParseArgsResult to return Parsed(T) or Usage(String) and expose it via src/common/mod.rs as command.
  • Update the brightness plugin to use parse_args and return a usage Action (label starts with Usage: bright) for partial/invalid inputs while still returning the dialog action for empty bright input.
  • Update the todo plugin to use parse_args for add, pset, tag, rm and to return usage Actions (labels like Usage: todo ...) for empty/invalid input while retaining zero-arg dialog/view actions.
  • Add/adjust unit tests in tests/brightness_plugin.rs and tests/todo_plugin.rs to validate usage responses and fuzz-ish partial queries such as "br", "bright", and "todo !" do not panic and surface helpful usage output.

Testing

  • Ran cargo test --test brightness_plugin --test todo_plugin to 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 fmt was run as part of the rollout to format changes (no test assertion impact).

Codex Task

@multiplex55 multiplex55 merged commit 8317ad0 into master Jan 17, 2026
1 check passed
@multiplex55 multiplex55 deleted the codex/implement-command-parsing-and-handling branch January 17, 2026 19:18
@multiplex55 multiplex55 restored the codex/implement-command-parsing-and-handling branch January 17, 2026 19:48
@multiplex55 multiplex55 deleted the codex/implement-command-parsing-and-handling branch January 17, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants