Refactor cli - #1
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the CLI module by reorganizing commands into structured subcommands and introducing a common utilities module. The changes improve code organization and maintainability by separating concerns into logical groups.
Changes:
- Introduced a
commands/common.rsmodule with reusable utilities for parsing, date conversion, and formatting - Refactored wiki, user, space, project, issue, git, activity, and team commands into modular subcommand structures
- Each command module now follows a consistent pattern:
args.rs(CLI arguments),handler.rs(command dispatcher), andsubcommands/(implementation modules)
Reviewed changes
Copilot reviewed 61 out of 63 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/src/commands/common.rs | New utility module with parsing, date conversion, and formatting helpers |
| cli/src/commands/wiki/* | Wiki commands refactored into subcommands: attachments, crud, list, shared_files |
| cli/src/commands/user/* | User commands refactored into subcommands: info, notifications, stars, watchings |
| cli/src/commands/space/* | Space commands refactored into subcommands: info, writable |
| cli/src/commands/project/* | Project commands refactored into extensive subcommands for categories, crud, custom_fields, issue_types, list, misc, statuses, teams, users, versions |
| cli/src/commands/issue/* | Issue commands refactored into subcommands: attachments, comments, crud, list, participants, shared_files |
| cli/src/commands/git/* | Git commands refactored into subcommands: pr, pr_attachments, pr_comments, repo |
| cli/src/commands/activity/* | Activity commands refactored with recent updates handler |
| cli/src/commands/team.rs | Team command updated to use CliResult and improved error handling |
| cli/src/commands/mod.rs | Updated to conditionally include all refactored command modules |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "This command requires write access to space and is not available. \ | ||
| Please build with the 'space_writable' feature flag:\ | ||
| \ | ||
| cargo build --package blg --features space_writable" |
There was a problem hiding this comment.
The error message has inconsistent line breaks and spacing. Line 35-36 has unnecessary line breaks that create awkward formatting. Consider joining lines 34-37 into a properly formatted multi-line string for better readability.
| "This command requires write access to space and is not available. \ | |
| Please build with the 'space_writable' feature flag:\ | |
| \ | |
| cargo build --package blg --features space_writable" | |
| "This command requires write access to space and is not available.\n\ | |
| Please build with the 'space_writable' feature flag:\n\ | |
| cargo build --package blg --features space_writable" |
| #[clap(short, long, default_value = "table")] | ||
| format: String, | ||
| }, | ||
| /// Get licence information |
There was a problem hiding this comment.
Corrected spelling of 'licence' to 'license' (American English spelling is more common in code).
| /// Get licence information | |
| /// Get license information |
| use backlog_api_client::client::BacklogApiClient; | ||
| #[cfg(feature = "space")] | ||
| use backlog_core::identifier::Identifier; | ||
| #[cfg(feature = "space")] |
There was a problem hiding this comment.
The type name 'GetLicenceParams' uses British spelling. While this may be consistent with the library API, consider documenting this spelling choice if it's intentional.
| #[cfg(feature = "space")] | |
| #[cfg(feature = "space")] | |
| // Note: `GetLicenceParams` uses British spelling to match the backlog_space API type name. | |
| #[cfg(feature = "space")] |
| pub(crate) async fn licence(client: &BacklogApiClient, format: String) -> CliResult<()> { | ||
| match client.space().get_licence(GetLicenceParams::new()).await { |
There was a problem hiding this comment.
Function name 'licence' uses British spelling. Consider using 'license' for consistency with American English conventions commonly used in code.
refactor cli (2) refactor cli (3) refactor cli (4) refactor cli (5) refactor cli (6) refactor cli (7) refactor cli (8) refactor cli (9) fix clippy errors
No description provided.