Skip to content

Refactor cli - #1

Merged
safx merged 10 commits into
mainfrom
refactor-cli
Jan 11, 2026
Merged

Refactor cli#1
safx merged 10 commits into
mainfrom
refactor-cli

Conversation

@safx

@safx safx commented Jan 11, 2026

Copy link
Copy Markdown
Owner

No description provided.

@safx
safx requested a review from Copilot January 11, 2026 09:41

Copilot AI left a comment

Copy link
Copy Markdown

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 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.rs module 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), and subcommands/ (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.

Comment on lines +33 to +36
"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"

Copilot AI Jan 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
"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"

Copilot uses AI. Check for mistakes.
#[clap(short, long, default_value = "table")]
format: String,
},
/// Get licence information

Copilot AI Jan 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'licence' to 'license' (American English spelling is more common in code).

Suggested change
/// Get licence information
/// Get license information

Copilot uses AI. Check for mistakes.
use backlog_api_client::client::BacklogApiClient;
#[cfg(feature = "space")]
use backlog_core::identifier::Identifier;
#[cfg(feature = "space")]

Copilot AI Jan 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
#[cfg(feature = "space")]
#[cfg(feature = "space")]
// Note: `GetLicenceParams` uses British spelling to match the backlog_space API type name.
#[cfg(feature = "space")]

Copilot uses AI. Check for mistakes.
Comment on lines +155 to +156
pub(crate) async fn licence(client: &BacklogApiClient, format: String) -> CliResult<()> {
match client.space().get_licence(GetLicenceParams::new()).await {

Copilot AI Jan 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function name 'licence' uses British spelling. Consider using 'license' for consistency with American English conventions commonly used in code.

Copilot uses AI. Check for mistakes.
@safx
safx merged commit 81a63d4 into main Jan 11, 2026
3 checks passed
safx added a commit that referenced this pull request Jan 11, 2026
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
@safx
safx deleted the refactor-cli branch January 11, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants