-
Notifications
You must be signed in to change notification settings - Fork 4
fix: properly flattening CLI arguments from the common structure #123
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
base: main
Are you sure you want to change the base?
Conversation
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 PR refactors the CLI argument handling to eliminate duplication by introducing a shared ClientArgs structure that is flattened into the CLI-specific argument structure. This creates a single source of truth for client configuration arguments.
Key Changes
- Introduced
ClientArgsas a shared structure for common client arguments (endpoint, timeout, cache settings) - Used
#[command(flatten)]to embedClientArgsinto the CLI'sClistructure - Removed duplicate argument definitions from the CLI binary
- Added comprehensive documentation explaining the architecture and how to add new arguments
- Reorganized
ClientConfig::load()with clear sections for applying CLI argument overrides - Added extensive test coverage for argument parsing and configuration loading
Reviewed changes
Copilot reviewed 1 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| modelexpress_common/src/client_config.rs | Added Clone derive to ClientArgs, removed -v short flag from log_level to avoid conflict with CLI's verbose flag, added extensive documentation about the argument architecture, reorganized ClientConfig::load() with clear sections, and added comprehensive tests for argument parsing |
| modelexpress_client/src/bin/modules/args.rs | Refactored to flatten ClientArgs into Cli struct, removed duplicate argument definitions (endpoint, timeout, cache_path, quiet), added extensive documentation, and added PartialEq derive to OutputFormat for test assertions |
| modelexpress_client/src/bin/cli.rs | Simplified main function by directly using flattened client_args, removed manual construction of ClientArgs, updated all references to use cli.client_args.*, added module-level documentation explaining the argument architecture, and added comprehensive integration tests |
This makes the CLI arguments work properly in the client CLI, like they do on the server. Signed-off-by: Nicolas Pixel Noble <pixel@nobis-crew.org>
ef335e5 to
d69a7f4
Compare
|
Thanks for the fixes. Do we know why some checks are failing? |
|
@nv-hwoo I suspect one of the failures is some access issue, token expiration or sth... Created one ticket in the backlog |
nv-hwoo
left a comment
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.
LGTM
|
@nicolasnoble looks like there's a clippy failure on the "Test Suite" check (thanks @AndyDai-nv for pointing out). |
Signed-off-by: Nicolas Pixel Noble <pixel@nobis-crew.org>
Signed-off-by: Nicolas Pixel Noble <pixel@nobis-crew.org>
cf517f1 to
1c42ab5
Compare
This makes the CLI arguments work properly in the client CLI, like they do on the server.