📌 Task CLI
一个基于 Typer 与 Rich 的命令行 Todo 工具,支持任务嵌套、树形展示、优先级象限、隐藏与搜索、Git 自动提交以及 TAPD CSV 导入。
🚀 快速开始
安装
# 建议使用虚拟环境
pip install todo-task-node-tree
如果是通过git克隆的,可在项目根目录执行:
pip install .
初始化
# 在当前目录创建数据文件 todos.json
todo init
添加任务
# 添加一级任务
todo add "写 README"
# 添加子任务,parent 指定父任务 ID
todo add "完善命令帮助文档" -p 1
# 指定优先级象限(1=🔥紧急重要・2=🧭重要・3=📤紧急・4=❌低优先,默认 2)
todo add "发布 PyPI 包" -q 1
列表展示
# 默认展示未完成任务,树形结构
todo list
# 显示所有任务(包括已完成、隐藏)
todo list --all
# 只看已完成
todo list --only-done
# 只看隐藏
todo list --only-hidden
# 高亮象限
todo list -q
设置当前任务
todo current 3
# “当前”任务会被特殊标记,便于聚焦
完成任务
# 标记任务为完成,自动记录 done 时间戳
todo done 2 5 --message "已完成当日目标"
若在 Git 仓库中执行,工具会自动
git add . && git commit -m "完成任务 …"并git push。
其他常用命令
| 命令 | 说明 |
|---|---|
todo delete <ID> |
删除指定任务及所有子任务 |
todo change <旧ID> <新ID> |
修改任务 ID |
todo rename <ID> <新内容> |
修改任务文本内容 |
todo move <ID> <新父ID> |
移动任务到另一父任务(0 代表顶层) |
todo hide <ID>… |
隐藏 / 取消隐藏 任务 |
todo search <关键词> |
按 ID 或文本模糊搜索 |
todo stats |
统计各象限已完成/未完成数量 |
todo import-tapd <CSV> |
从 TAPD 导出的 CSV 文件批量导入任务 |
📂 数据存储
-
默认在运行目录下创建并维护
todos.json。 -
存储格式:
{ "meta": { "current": 3 }, "todos": [ { "id": 1, "text": "写 README", "parent": null, "quadrant": 2, "created_at": "2025-05-25T15:00:00", "done": false, "done_at": null, "hidden": false }, … ] }
🛠️ 开发 & 发布
-
环境准备
python -m venv .venv source .venv/bin/activate # Linux / macOS .venv\Scripts\activate.bat # Windows pip install -r requirements.txt
-
项目结构
. ├── app.py # Typer 主入口(`todo` 命令) ├── main.py # 内部实现(保留兼容) ├── commands/ # 各子命令实现 ├── core/ # 数据与 Git 工具模块 ├── todos.json # 默认数据文件 ├── README.md # 本文件 └── setup.py / pyproject.toml # 打包配置(待添加)
-
运行测试
如有测试可在此补充,如使用
pytest。pytest
-
打包 & 上传 PyPI
-
使用
setup.py:python setup.py sdist bdist_wheel twine upload dist/*
-
使用
pyproject.toml+ Poetry:poetry build poetry publish --username <用户名> --password <密码>
-
🤝 贡献
欢迎提交 Issue 或 PR!
-
Fork 本仓库
-
新建分支
feat/your-feature -
提交代码 & 测试
-
发起 Pull Request
📄 License
本项目采用 MIT License —— 详情请查看 LICENSE 文件。
Release files for todo-task-node-tree 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| todo_task_node_tree-0.1.1.tar.gz | 12.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| todo_task_node_tree-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.7 kB
Release files / todo_task_node_tree-0.1.1.tar.gz
| Download URL | todo_task_node_tree-0.1.1.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
44b614df04484fd64b34790b8e7a770aacc2bd3fa6b7cf4be3f5d342cf9f1650
|
|
BLAKE2b-256 checksum How to use checksums |
b907d3508d693558c66f252296388d5814a6b7f9e0524d8a4497a4e9316de86b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / todo_task_node_tree-0.1.1-py3-none-any.whl
| Download URL | todo_task_node_tree-0.1.1-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
69677aa723fc11c1827d713062cf507c80f6725a583b0cc47322b26e6f0b4e31
|
|
BLAKE2b-256 checksum How to use checksums |
9516080380eff0a56d6235decb6671d2ed8ee04229c26c322d6400c75b5b95d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|