Skip to content

refactor: restructure codebase with modular command and utility organization#8

Merged
inureyes merged 2 commits into
mainfrom
refactor/code-structure
Aug 22, 2025
Merged

refactor: restructure codebase with modular command and utility organization#8
inureyes merged 2 commits into
mainfrom
refactor/code-structure

Conversation

@inureyes
Copy link
Copy Markdown
Member

Summary

  • Restructured codebase for better maintainability and scalability
  • Reduced main.rs from 987 lines to ~150 lines (84% reduction)
  • Separated commands into individual modules for better testability

Changes

New Modular Structure

  • commands/ - Each command in its own module

    • exec.rs - Command execution (~75 lines)
    • ping.rs - Connectivity testing (~80 lines)
    • list.rs - Cluster listing (~50 lines)
    • upload.rs - File upload (~175 lines)
    • download.rs - File download (~240 lines)
  • utils/ - Reusable utility functions

    • fs.rs - File system operations (glob, walk, format)
    • output.rs - Output file management
    • logging.rs - Logging initialization

Benefits

  • Improved Maintainability: Each command is self-contained
  • Better Testability: Individual modules can be tested in isolation
  • Enhanced Scalability: New commands can be added without touching main.rs
  • Code Reusability: Utility functions are shared across commands
  • Clear Separation of Concerns: Each module has a single responsibility

Metrics

  • Main.rs size: 987 → 150 lines (84% reduction)
  • Average module size: ~100 lines
  • Total modules created: 9 new files
  • No functionality changes, only structural improvements

Test Plan

  • All existing functionality preserved
  • Cargo build successful
  • Cargo clippy passes
  • Help command works
  • List command works

@inureyes inureyes added the type:refactor Code refactoring label Aug 22, 2025
@inureyes inureyes self-assigned this Aug 22, 2025
@inureyes inureyes merged commit 92a4100 into main Aug 22, 2025
3 checks passed
@inureyes inureyes added priority:low Low priority issue status:done Completed labels Sep 9, 2025
@inureyes inureyes deleted the refactor/code-structure branch October 30, 2025 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:low Low priority issue status:done Completed type:refactor Code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant