Files
banks2ff/banks2ff/src/commands/transactions/mod.rs
Jacob Kiers 5f54124015 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.
2025-11-29 01:22:49 +01:00

42 lines
1015 B
Rust

pub mod cache;
pub mod clear;
pub mod list;
use crate::core::config::Config;
use clap::Subcommand;
use self::cache::handle_cache_status;
use self::clear::handle_clear_cache;
use self::list::handle_list as handle_transaction_list;
#[derive(Subcommand, Debug)]
pub enum TransactionCommands {
/// List transactions for an account
List {
/// Account ID to list transactions for
account_id: String,
},
/// Show cache status
CacheStatus,
/// Clear transaction cache
ClearCache,
}
pub async fn handle_transactions(
config: Config,
subcommand: TransactionCommands,
) -> anyhow::Result<()> {
match subcommand {
TransactionCommands::List { account_id } => {
handle_transaction_list(config, account_id).await?;
}
TransactionCommands::CacheStatus => {
handle_cache_status(config).await?;
}
TransactionCommands::ClearCache => {
handle_clear_cache(config).await?;
}
}
Ok(())
}