chore: Move all command handlers to their own files

This makes the code much easier to follow and shortens main.rs from
>1000 lines to around 150.
This commit is contained in:
2025-11-29 00:54:46 +01:00
parent 095e15cd5f
commit 5f54124015
19 changed files with 1057 additions and 918 deletions

View File

@@ -10,9 +10,19 @@ Banks2FF implements a **Hexagonal (Ports & Adapters) Architecture** to synchroni
banks2ff/
├── banks2ff/ # Main CLI application
│ └── src/
│ ├── commands/ # Command handlers
│ │ ├── accounts/ # Account management commands
│ │ │ ├── mod.rs # Account commands dispatch
│ │ │ ├── link.rs # Account linking logic
│ │ │ ├── list.rs # Account listing functionality
│ │ │ └── status.rs # Account status functionality
│ │ ├── transactions/ # Transaction management commands
│ │ ├── list.rs # Source/destination listing
│ │ └── sync.rs # Sync command handler
│ ├── cli/ # CLI utilities and formatting
│ ├── core/ # Domain logic and models
│ ├── adapters/ # External service integrations
│ └── main.rs # CLI entry point
│ └── main.rs # CLI entry point and command dispatch
├── firefly-client/ # Firefly III API client library
├── gocardless-client/ # GoCardless API client library
└── docs/ # Architecture documentation
@@ -49,7 +59,15 @@ banks2ff/
- `client.rs`: Wrapper for Firefly client for transaction storage
- Maps domain models to Firefly API format
### 3. API Clients
### 3. Command Handlers (`banks2ff/src/commands/`)
The CLI commands are organized into focused modules:
- **sync.rs**: Handles transaction synchronization between sources and destinations
- **accounts/**: Account management including linking, listing, and status
- **transactions/**: Transaction inspection, caching, and cache management
- **list.rs**: Simple listing of available sources and destinations
### 4. API Clients
Both clients are hand-crafted using `reqwest`:
- Strongly-typed DTOs for compile-time safety