1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(name = "spendr")]
#[command(about = "Import and analyze financial transactions from CSV and PDF files", long_about = None)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
Import {
#[arg(
default_value = ".",
help = "Path to file or directory to import (defaults to current directory)"
)]
path: String,
#[arg(long, help = "Show what would be imported without actually importing")]
dry_run: bool,
#[arg(
long,
help = "Override auto-detection with specific bank type: cibc, bmo, td, simplii, wise"
)]
bank: Option<String>,
},
Summary {
#[arg(short, long, help = "Show spending by category")]
categories: bool,
#[arg(short, long, help = "Show spending by month")]
monthly: bool,
#[arg(short, long, help = "Show income vs expenses")]
overview: bool,
#[arg(
long,
help = "Include transfers in expense calculations (default: excludes transfers)"
)]
include_transfers: bool,
#[arg(long, help = "Start date for filtering (YYYY-MM-DD)")]
from: Option<String>,
#[arg(long, help = "End date for filtering (YYYY-MM-DD)")]
to: Option<String>,
#[arg(long, help = "Show yearly summary")]
yearly: bool,
#[arg(long, help = "Show quarterly summary")]
quarterly: bool,
#[arg(long, help = "Export format: csv, json")]
export: Option<String>,
},
Recent {
#[arg(
short,
long,
default_value = "10",
help = "Number of recent transactions"
)]
limit: usize,
#[arg(long, help = "Start date for filtering (YYYY-MM-DD)")]
from: Option<String>,
#[arg(long, help = "End date for filtering (YYYY-MM-DD)")]
to: Option<String>,
},
Budget {
#[arg(short, long, help = "Set budget for category")]
set: Option<String>,
#[arg(short, long, help = "Budget amount")]
amount: Option<f64>,
#[arg(short, long, help = "Check budget status")]
check: bool,
},
Analytics {
#[arg(long, help = "Show spending trends for categories")]
trends: bool,
#[arg(long, help = "Show net worth over time")]
net_worth: bool,
#[arg(long, help = "Get spending insights and recommendations")]
insights: bool,
#[arg(long, help = "Specific category to analyze (e.g., Coffee, Personal Care)")]
category: Option<String>,
#[arg(long, default_value = "12", help = "Number of months to analyze")]
months: usize,
},
Investment {
#[arg(long, help = "Show portfolio analysis and performance")]
portfolio: bool,
#[arg(long, help = "Show true net worth including investments")]
net_worth: bool,
#[arg(long, help = "Show asset allocation analysis")]
allocation: bool,
#[arg(long, help = "Get investment recommendations")]
recommendations: bool,
#[arg(long, help = "Sync data from broker APIs")]
sync: bool,
#[arg(long, help = "Show top/worst performing positions")]
performance: bool,
#[arg(long, help = "Import WealthSimple CSV files from directory")]
import_wealthsimple: Option<String>,
#[arg(long, help = "Export investment data to CSV")]
export_csv: Option<String>,
#[arg(long, help = "Generate tax summary for year (requires --export-csv)")]
tax_year: Option<i32>,
#[arg(long, help = "Show detailed performance dashboard with benchmarks")]
dashboard: bool,
#[arg(long, help = "Show position-level performance analysis")]
position_analysis: bool,
#[arg(long, help = "Analyze portfolio rebalancing needs")]
rebalance: bool,
#[arg(long, help = "Target allocation strategy: conservative, balanced, growth, aggressive")]
strategy: Option<String>,
#[arg(long, default_value = "5.0", help = "Rebalancing threshold percentage")]
threshold: f64,
},
#[command(
about = "Launch the Terminal User Interface (TUI) for interactive viewing",
long_about = "Launch an interactive Terminal User Interface (TUI) with a Mint.com-inspired design.\n\n\
Features:\n\
• Dashboard view with net worth, cash flow, and spending categories\n\
• Full transaction history with search and filtering\n\
• Budget tracking and status indicators\n\
• Investment portfolio overview\n\n\
Navigation:\n\
• Tab/Shift+Tab - Switch between views\n\
• j/k or ↑/↓ - Navigate lists\n\
• / - Search transactions\n\
• ? - Show help\n\
• q - Quit\n\n\
View shortcuts:\n\
• d - Dashboard\n\
• t - Transactions\n\
• b - Budgets\n\
• i - Investments"
)]
Tui,
}
|