coder-firefly-cli 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- coder_firefly_cli-1.0.0/PKG-INFO +239 -0
- coder_firefly_cli-1.0.0/README.md +201 -0
- coder_firefly_cli-1.0.0/setup.cfg +4 -0
- coder_firefly_cli-1.0.0/setup.py +43 -0
- coder_firefly_cli-1.0.0/src/coder_firefly_cli.egg-info/PKG-INFO +239 -0
- coder_firefly_cli-1.0.0/src/coder_firefly_cli.egg-info/SOURCES.txt +21 -0
- coder_firefly_cli-1.0.0/src/coder_firefly_cli.egg-info/dependency_links.txt +1 -0
- coder_firefly_cli-1.0.0/src/coder_firefly_cli.egg-info/entry_points.txt +2 -0
- coder_firefly_cli-1.0.0/src/coder_firefly_cli.egg-info/requires.txt +7 -0
- coder_firefly_cli-1.0.0/src/coder_firefly_cli.egg-info/top_level.txt +1 -0
- coder_firefly_cli-1.0.0/src/commands/__init__.py +1 -0
- coder_firefly_cli-1.0.0/src/commands/accounts.py +113 -0
- coder_firefly_cli-1.0.0/src/commands/bills.py +99 -0
- coder_firefly_cli-1.0.0/src/commands/budgets.py +147 -0
- coder_firefly_cli-1.0.0/src/commands/categories.py +79 -0
- coder_firefly_cli-1.0.0/src/commands/info.py +36 -0
- coder_firefly_cli-1.0.0/src/commands/insights.py +87 -0
- coder_firefly_cli-1.0.0/src/commands/piggy_banks.py +99 -0
- coder_firefly_cli-1.0.0/src/commands/search.py +25 -0
- coder_firefly_cli-1.0.0/src/commands/tags.py +100 -0
- coder_firefly_cli-1.0.0/src/commands/transactions.py +151 -0
- coder_firefly_cli-1.0.0/tests/test_api_client.py +422 -0
- coder_firefly_cli-1.0.0/tests/test_commands.py +421 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: coder-firefly-cli
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Firefly III CLI - 个人财务管理命令行工具
|
|
5
|
+
Home-page: https://github.com/joyous-coder/coder-firefly-cli
|
|
6
|
+
Author: coder
|
|
7
|
+
Author-email: coder@example.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: firefly-iii cli finance personal-finance
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
Requires-Dist: click>=8.0
|
|
21
|
+
Requires-Dist: requests>=2.25
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
25
|
+
Requires-Dist: responses>=0.25; extra == "dev"
|
|
26
|
+
Dynamic: author
|
|
27
|
+
Dynamic: author-email
|
|
28
|
+
Dynamic: classifier
|
|
29
|
+
Dynamic: description
|
|
30
|
+
Dynamic: description-content-type
|
|
31
|
+
Dynamic: home-page
|
|
32
|
+
Dynamic: keywords
|
|
33
|
+
Dynamic: license
|
|
34
|
+
Dynamic: provides-extra
|
|
35
|
+
Dynamic: requires-dist
|
|
36
|
+
Dynamic: requires-python
|
|
37
|
+
Dynamic: summary
|
|
38
|
+
|
|
39
|
+
# coder-firefly-cli
|
|
40
|
+
|
|
41
|
+
Firefly III CLI - 个人财务管理命令行工具
|
|
42
|
+
|
|
43
|
+
## 安装
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install -e .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## 前提条件
|
|
50
|
+
|
|
51
|
+
- Python 3.10+
|
|
52
|
+
- 运行中的 Firefly III 实例
|
|
53
|
+
- Personal Access Token (PAT)
|
|
54
|
+
|
|
55
|
+
## 配置
|
|
56
|
+
|
|
57
|
+
### 环境变量(推荐)
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
export FIREFLY_BASE_URL="https://firefly.yourdomain.com"
|
|
61
|
+
export FIREFLY_PAT="your-personal-access-token"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 命令行参数
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
coder-firefly-cli --base-url https://firefly.yourdomain.com --pat your-token accounts list
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 使用方法
|
|
71
|
+
|
|
72
|
+
### 账户管理
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# 列出账户
|
|
76
|
+
coder-firefly-cli accounts list
|
|
77
|
+
coder-firefly-cli accounts list --type asset
|
|
78
|
+
|
|
79
|
+
# 获取账户详情
|
|
80
|
+
coder-firefly-cli accounts get --id 123
|
|
81
|
+
|
|
82
|
+
# 创建账户
|
|
83
|
+
coder-firefly-cli accounts create --name "现金" --type asset --currency-code CNY
|
|
84
|
+
|
|
85
|
+
# 更新账户
|
|
86
|
+
coder-firefly-cli accounts update --id 123 --name "新名称"
|
|
87
|
+
|
|
88
|
+
# 删除账户
|
|
89
|
+
coder-firefly-cli accounts delete --id 123
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 交易管理
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# 列出交易
|
|
96
|
+
coder-firefly-cli transactions list
|
|
97
|
+
coder-firefly-cli transactions list --limit 10 --start 2024-01-01
|
|
98
|
+
|
|
99
|
+
# 创建支出
|
|
100
|
+
coder-firefly-cli transactions create --description "超市购物" --amount 100.00 --source-account 1
|
|
101
|
+
|
|
102
|
+
# 创建转账
|
|
103
|
+
coder-firefly-cli transactions create --description "转账" --amount 500.00 --source-account 1 --destination-account 2 --type transfer
|
|
104
|
+
|
|
105
|
+
# 获取交易详情
|
|
106
|
+
coder-firefly-cli transactions get --id 456
|
|
107
|
+
|
|
108
|
+
# 删除交易
|
|
109
|
+
coder-firefly-cli transactions delete --id 456
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 预算管理
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# 列出预算
|
|
116
|
+
coder-firefly-cli budgets list
|
|
117
|
+
|
|
118
|
+
# 创建预算
|
|
119
|
+
coder-firefly-cli budgets create --name "餐饮预算"
|
|
120
|
+
|
|
121
|
+
# 设置预算限额
|
|
122
|
+
coder-firefly-cli budgets limit-create --budget-id 1 --amount 2000 --start 2024-01-01 --end 2024-01-31
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 分类管理
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# 列出分类
|
|
129
|
+
coder-firefly-cli categories list
|
|
130
|
+
|
|
131
|
+
# 创建分类
|
|
132
|
+
coder-firefly-cli categories create --name "餐饮"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 标签管理
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# 列出标签
|
|
139
|
+
coder-firefly-cli tags list
|
|
140
|
+
|
|
141
|
+
# 创建标签
|
|
142
|
+
coder-firefly-cli tags create --tag "重要"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 账单管理
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# 列出账单
|
|
149
|
+
coder-firefly-cli bills list
|
|
150
|
+
|
|
151
|
+
# 创建账单
|
|
152
|
+
coder-firefly-cli bills create --name "房租" --amount-min 3000 --amount-max 3000 --date 2024-01-01
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### 储蓄罐管理
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# 列出储蓄罐
|
|
159
|
+
coder-firefly-cli piggy-banks list
|
|
160
|
+
|
|
161
|
+
# 创建储蓄罐
|
|
162
|
+
coder-firefly-cli piggy-banks create --name "旅行基金" --account-id 1 --target-amount 10000
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### 搜索
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# 搜索交易
|
|
169
|
+
coder-firefly-cli search transactions --query "超市"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### 洞察报告
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# 支出洞察
|
|
176
|
+
coder-firefly-cli insights expense --start 2024-01-01 --end 2024-01-31
|
|
177
|
+
|
|
178
|
+
# 收入洞察
|
|
179
|
+
coder-firefly-cli insights income --start 2024-01-01 --end 2024-01-31
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 系统信息
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# 获取系统信息
|
|
186
|
+
coder-firefly-cli info about
|
|
187
|
+
|
|
188
|
+
# 检查连接状态
|
|
189
|
+
coder-firefly-cli info status
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## JSON 输出
|
|
193
|
+
|
|
194
|
+
所有命令都支持 `--json` 参数以结构化格式输出:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
coder-firefly-cli --json accounts list
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## 故障排除
|
|
201
|
+
|
|
202
|
+
### 连接失败
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
错误: 无法连接到 Firefly III 实例
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
检查:
|
|
209
|
+
1. Firefly III 实例是否正在运行
|
|
210
|
+
2. 基础 URL 是否正确
|
|
211
|
+
3. 网络连接是否正常
|
|
212
|
+
|
|
213
|
+
### 认证失败
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
错误: 认证失败: Personal Access Token 无效
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
检查:
|
|
220
|
+
1. PAT 是否正确
|
|
221
|
+
2. PAT 是否已过期
|
|
222
|
+
3. 在 Firefly III 的 选项 > 个人资料 > OAuth 中生成新的 PAT
|
|
223
|
+
|
|
224
|
+
## 开发
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# 安装依赖
|
|
228
|
+
pip install -e ".[dev]"
|
|
229
|
+
|
|
230
|
+
# 运行测试
|
|
231
|
+
pytest
|
|
232
|
+
|
|
233
|
+
# 代码格式化
|
|
234
|
+
black src/
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## 许可证
|
|
238
|
+
|
|
239
|
+
MIT License
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# coder-firefly-cli
|
|
2
|
+
|
|
3
|
+
Firefly III CLI - 个人财务管理命令行工具
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install -e .
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 前提条件
|
|
12
|
+
|
|
13
|
+
- Python 3.10+
|
|
14
|
+
- 运行中的 Firefly III 实例
|
|
15
|
+
- Personal Access Token (PAT)
|
|
16
|
+
|
|
17
|
+
## 配置
|
|
18
|
+
|
|
19
|
+
### 环境变量(推荐)
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
export FIREFLY_BASE_URL="https://firefly.yourdomain.com"
|
|
23
|
+
export FIREFLY_PAT="your-personal-access-token"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 命令行参数
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
coder-firefly-cli --base-url https://firefly.yourdomain.com --pat your-token accounts list
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## 使用方法
|
|
33
|
+
|
|
34
|
+
### 账户管理
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# 列出账户
|
|
38
|
+
coder-firefly-cli accounts list
|
|
39
|
+
coder-firefly-cli accounts list --type asset
|
|
40
|
+
|
|
41
|
+
# 获取账户详情
|
|
42
|
+
coder-firefly-cli accounts get --id 123
|
|
43
|
+
|
|
44
|
+
# 创建账户
|
|
45
|
+
coder-firefly-cli accounts create --name "现金" --type asset --currency-code CNY
|
|
46
|
+
|
|
47
|
+
# 更新账户
|
|
48
|
+
coder-firefly-cli accounts update --id 123 --name "新名称"
|
|
49
|
+
|
|
50
|
+
# 删除账户
|
|
51
|
+
coder-firefly-cli accounts delete --id 123
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 交易管理
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# 列出交易
|
|
58
|
+
coder-firefly-cli transactions list
|
|
59
|
+
coder-firefly-cli transactions list --limit 10 --start 2024-01-01
|
|
60
|
+
|
|
61
|
+
# 创建支出
|
|
62
|
+
coder-firefly-cli transactions create --description "超市购物" --amount 100.00 --source-account 1
|
|
63
|
+
|
|
64
|
+
# 创建转账
|
|
65
|
+
coder-firefly-cli transactions create --description "转账" --amount 500.00 --source-account 1 --destination-account 2 --type transfer
|
|
66
|
+
|
|
67
|
+
# 获取交易详情
|
|
68
|
+
coder-firefly-cli transactions get --id 456
|
|
69
|
+
|
|
70
|
+
# 删除交易
|
|
71
|
+
coder-firefly-cli transactions delete --id 456
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 预算管理
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# 列出预算
|
|
78
|
+
coder-firefly-cli budgets list
|
|
79
|
+
|
|
80
|
+
# 创建预算
|
|
81
|
+
coder-firefly-cli budgets create --name "餐饮预算"
|
|
82
|
+
|
|
83
|
+
# 设置预算限额
|
|
84
|
+
coder-firefly-cli budgets limit-create --budget-id 1 --amount 2000 --start 2024-01-01 --end 2024-01-31
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 分类管理
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# 列出分类
|
|
91
|
+
coder-firefly-cli categories list
|
|
92
|
+
|
|
93
|
+
# 创建分类
|
|
94
|
+
coder-firefly-cli categories create --name "餐饮"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 标签管理
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# 列出标签
|
|
101
|
+
coder-firefly-cli tags list
|
|
102
|
+
|
|
103
|
+
# 创建标签
|
|
104
|
+
coder-firefly-cli tags create --tag "重要"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 账单管理
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# 列出账单
|
|
111
|
+
coder-firefly-cli bills list
|
|
112
|
+
|
|
113
|
+
# 创建账单
|
|
114
|
+
coder-firefly-cli bills create --name "房租" --amount-min 3000 --amount-max 3000 --date 2024-01-01
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 储蓄罐管理
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# 列出储蓄罐
|
|
121
|
+
coder-firefly-cli piggy-banks list
|
|
122
|
+
|
|
123
|
+
# 创建储蓄罐
|
|
124
|
+
coder-firefly-cli piggy-banks create --name "旅行基金" --account-id 1 --target-amount 10000
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 搜索
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# 搜索交易
|
|
131
|
+
coder-firefly-cli search transactions --query "超市"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 洞察报告
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# 支出洞察
|
|
138
|
+
coder-firefly-cli insights expense --start 2024-01-01 --end 2024-01-31
|
|
139
|
+
|
|
140
|
+
# 收入洞察
|
|
141
|
+
coder-firefly-cli insights income --start 2024-01-01 --end 2024-01-31
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 系统信息
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# 获取系统信息
|
|
148
|
+
coder-firefly-cli info about
|
|
149
|
+
|
|
150
|
+
# 检查连接状态
|
|
151
|
+
coder-firefly-cli info status
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## JSON 输出
|
|
155
|
+
|
|
156
|
+
所有命令都支持 `--json` 参数以结构化格式输出:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
coder-firefly-cli --json accounts list
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## 故障排除
|
|
163
|
+
|
|
164
|
+
### 连接失败
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
错误: 无法连接到 Firefly III 实例
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
检查:
|
|
171
|
+
1. Firefly III 实例是否正在运行
|
|
172
|
+
2. 基础 URL 是否正确
|
|
173
|
+
3. 网络连接是否正常
|
|
174
|
+
|
|
175
|
+
### 认证失败
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
错误: 认证失败: Personal Access Token 无效
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
检查:
|
|
182
|
+
1. PAT 是否正确
|
|
183
|
+
2. PAT 是否已过期
|
|
184
|
+
3. 在 Firefly III 的 选项 > 个人资料 > OAuth 中生成新的 PAT
|
|
185
|
+
|
|
186
|
+
## 开发
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# 安装依赖
|
|
190
|
+
pip install -e ".[dev]"
|
|
191
|
+
|
|
192
|
+
# 运行测试
|
|
193
|
+
pytest
|
|
194
|
+
|
|
195
|
+
# 代码格式化
|
|
196
|
+
black src/
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## 许可证
|
|
200
|
+
|
|
201
|
+
MIT License
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="coder-firefly-cli",
|
|
5
|
+
version="1.0.0",
|
|
6
|
+
description="Firefly III CLI - 个人财务管理命令行工具",
|
|
7
|
+
long_description=open("README.md", encoding="utf-8").read(),
|
|
8
|
+
long_description_content_type="text/markdown",
|
|
9
|
+
author="coder",
|
|
10
|
+
author_email="coder@example.com",
|
|
11
|
+
url="https://github.com/joyous-coder/coder-firefly-cli",
|
|
12
|
+
packages=find_packages(where="src"),
|
|
13
|
+
package_dir={"": "src"},
|
|
14
|
+
entry_points={
|
|
15
|
+
"console_scripts": [
|
|
16
|
+
"coder-firefly-cli=cli:main",
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
install_requires=[
|
|
20
|
+
"click>=8.0",
|
|
21
|
+
"requests>=2.25",
|
|
22
|
+
],
|
|
23
|
+
extras_require={
|
|
24
|
+
"dev": [
|
|
25
|
+
"pytest>=7.0",
|
|
26
|
+
"pytest-cov>=4.0",
|
|
27
|
+
"responses>=0.25",
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
python_requires=">=3.10",
|
|
31
|
+
classifiers=[
|
|
32
|
+
"Development Status :: 4 - Beta",
|
|
33
|
+
"Intended Audience :: End Users/Desktop",
|
|
34
|
+
"License :: OSI Approved :: MIT License",
|
|
35
|
+
"Programming Language :: Python :: 3",
|
|
36
|
+
"Programming Language :: Python :: 3.10",
|
|
37
|
+
"Programming Language :: Python :: 3.11",
|
|
38
|
+
"Programming Language :: Python :: 3.12",
|
|
39
|
+
"Topic :: Office/Business :: Financial",
|
|
40
|
+
],
|
|
41
|
+
keywords="firefly-iii cli finance personal-finance",
|
|
42
|
+
license="MIT",
|
|
43
|
+
)
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: coder-firefly-cli
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Firefly III CLI - 个人财务管理命令行工具
|
|
5
|
+
Home-page: https://github.com/joyous-coder/coder-firefly-cli
|
|
6
|
+
Author: coder
|
|
7
|
+
Author-email: coder@example.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: firefly-iii cli finance personal-finance
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
Requires-Dist: click>=8.0
|
|
21
|
+
Requires-Dist: requests>=2.25
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
25
|
+
Requires-Dist: responses>=0.25; extra == "dev"
|
|
26
|
+
Dynamic: author
|
|
27
|
+
Dynamic: author-email
|
|
28
|
+
Dynamic: classifier
|
|
29
|
+
Dynamic: description
|
|
30
|
+
Dynamic: description-content-type
|
|
31
|
+
Dynamic: home-page
|
|
32
|
+
Dynamic: keywords
|
|
33
|
+
Dynamic: license
|
|
34
|
+
Dynamic: provides-extra
|
|
35
|
+
Dynamic: requires-dist
|
|
36
|
+
Dynamic: requires-python
|
|
37
|
+
Dynamic: summary
|
|
38
|
+
|
|
39
|
+
# coder-firefly-cli
|
|
40
|
+
|
|
41
|
+
Firefly III CLI - 个人财务管理命令行工具
|
|
42
|
+
|
|
43
|
+
## 安装
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install -e .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## 前提条件
|
|
50
|
+
|
|
51
|
+
- Python 3.10+
|
|
52
|
+
- 运行中的 Firefly III 实例
|
|
53
|
+
- Personal Access Token (PAT)
|
|
54
|
+
|
|
55
|
+
## 配置
|
|
56
|
+
|
|
57
|
+
### 环境变量(推荐)
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
export FIREFLY_BASE_URL="https://firefly.yourdomain.com"
|
|
61
|
+
export FIREFLY_PAT="your-personal-access-token"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 命令行参数
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
coder-firefly-cli --base-url https://firefly.yourdomain.com --pat your-token accounts list
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 使用方法
|
|
71
|
+
|
|
72
|
+
### 账户管理
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# 列出账户
|
|
76
|
+
coder-firefly-cli accounts list
|
|
77
|
+
coder-firefly-cli accounts list --type asset
|
|
78
|
+
|
|
79
|
+
# 获取账户详情
|
|
80
|
+
coder-firefly-cli accounts get --id 123
|
|
81
|
+
|
|
82
|
+
# 创建账户
|
|
83
|
+
coder-firefly-cli accounts create --name "现金" --type asset --currency-code CNY
|
|
84
|
+
|
|
85
|
+
# 更新账户
|
|
86
|
+
coder-firefly-cli accounts update --id 123 --name "新名称"
|
|
87
|
+
|
|
88
|
+
# 删除账户
|
|
89
|
+
coder-firefly-cli accounts delete --id 123
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 交易管理
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# 列出交易
|
|
96
|
+
coder-firefly-cli transactions list
|
|
97
|
+
coder-firefly-cli transactions list --limit 10 --start 2024-01-01
|
|
98
|
+
|
|
99
|
+
# 创建支出
|
|
100
|
+
coder-firefly-cli transactions create --description "超市购物" --amount 100.00 --source-account 1
|
|
101
|
+
|
|
102
|
+
# 创建转账
|
|
103
|
+
coder-firefly-cli transactions create --description "转账" --amount 500.00 --source-account 1 --destination-account 2 --type transfer
|
|
104
|
+
|
|
105
|
+
# 获取交易详情
|
|
106
|
+
coder-firefly-cli transactions get --id 456
|
|
107
|
+
|
|
108
|
+
# 删除交易
|
|
109
|
+
coder-firefly-cli transactions delete --id 456
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 预算管理
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# 列出预算
|
|
116
|
+
coder-firefly-cli budgets list
|
|
117
|
+
|
|
118
|
+
# 创建预算
|
|
119
|
+
coder-firefly-cli budgets create --name "餐饮预算"
|
|
120
|
+
|
|
121
|
+
# 设置预算限额
|
|
122
|
+
coder-firefly-cli budgets limit-create --budget-id 1 --amount 2000 --start 2024-01-01 --end 2024-01-31
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 分类管理
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# 列出分类
|
|
129
|
+
coder-firefly-cli categories list
|
|
130
|
+
|
|
131
|
+
# 创建分类
|
|
132
|
+
coder-firefly-cli categories create --name "餐饮"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 标签管理
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# 列出标签
|
|
139
|
+
coder-firefly-cli tags list
|
|
140
|
+
|
|
141
|
+
# 创建标签
|
|
142
|
+
coder-firefly-cli tags create --tag "重要"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 账单管理
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# 列出账单
|
|
149
|
+
coder-firefly-cli bills list
|
|
150
|
+
|
|
151
|
+
# 创建账单
|
|
152
|
+
coder-firefly-cli bills create --name "房租" --amount-min 3000 --amount-max 3000 --date 2024-01-01
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### 储蓄罐管理
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# 列出储蓄罐
|
|
159
|
+
coder-firefly-cli piggy-banks list
|
|
160
|
+
|
|
161
|
+
# 创建储蓄罐
|
|
162
|
+
coder-firefly-cli piggy-banks create --name "旅行基金" --account-id 1 --target-amount 10000
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### 搜索
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# 搜索交易
|
|
169
|
+
coder-firefly-cli search transactions --query "超市"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### 洞察报告
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# 支出洞察
|
|
176
|
+
coder-firefly-cli insights expense --start 2024-01-01 --end 2024-01-31
|
|
177
|
+
|
|
178
|
+
# 收入洞察
|
|
179
|
+
coder-firefly-cli insights income --start 2024-01-01 --end 2024-01-31
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 系统信息
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# 获取系统信息
|
|
186
|
+
coder-firefly-cli info about
|
|
187
|
+
|
|
188
|
+
# 检查连接状态
|
|
189
|
+
coder-firefly-cli info status
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## JSON 输出
|
|
193
|
+
|
|
194
|
+
所有命令都支持 `--json` 参数以结构化格式输出:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
coder-firefly-cli --json accounts list
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## 故障排除
|
|
201
|
+
|
|
202
|
+
### 连接失败
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
错误: 无法连接到 Firefly III 实例
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
检查:
|
|
209
|
+
1. Firefly III 实例是否正在运行
|
|
210
|
+
2. 基础 URL 是否正确
|
|
211
|
+
3. 网络连接是否正常
|
|
212
|
+
|
|
213
|
+
### 认证失败
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
错误: 认证失败: Personal Access Token 无效
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
检查:
|
|
220
|
+
1. PAT 是否正确
|
|
221
|
+
2. PAT 是否已过期
|
|
222
|
+
3. 在 Firefly III 的 选项 > 个人资料 > OAuth 中生成新的 PAT
|
|
223
|
+
|
|
224
|
+
## 开发
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# 安装依赖
|
|
228
|
+
pip install -e ".[dev]"
|
|
229
|
+
|
|
230
|
+
# 运行测试
|
|
231
|
+
pytest
|
|
232
|
+
|
|
233
|
+
# 代码格式化
|
|
234
|
+
black src/
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## 许可证
|
|
238
|
+
|
|
239
|
+
MIT License
|