Skip to main content

📌 基于 Typer 与 Rich 的命令行 Todo 工具

Project description

📌 Task CLI

Python Version License

一个基于 TyperRich 的命令行 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
        },
        
      ]
    }
    

🛠️ 开发 & 发布

  1. 环境准备

    python -m venv .venv
    source .venv/bin/activate    # Linux / macOS
    .venv\Scripts\activate.bat   # Windows
    pip install -r requirements.txt
    
  2. 项目结构

    .
    ├── app.py                 # Typer 主入口(`todo` 命令)
    ├── main.py                # 内部实现(保留兼容)
    ├── commands/              # 各子命令实现
    ├── core/                  # 数据与 Git 工具模块
    ├── todos.json             # 默认数据文件
    ├── README.md              # 本文件
    └── setup.py / pyproject.toml  # 打包配置(待添加)
    
  3. 运行测试

    如有测试可在此补充,如使用 pytest

    pytest
    
  4. 打包 & 上传 PyPI

    • 使用 setup.py

      python setup.py sdist bdist_wheel
      twine upload dist/*
      
    • 使用 pyproject.toml + Poetry

      poetry build
      poetry publish --username <用户名> --password <密码>
      

🤝 贡献

欢迎提交 Issue 或 PR!

  1. Fork 本仓库

  2. 新建分支 feat/your-feature

  3. 提交代码 & 测试

  4. 发起 Pull Request


📄 License

本项目采用 MIT License —— 详情请查看 LICENSE 文件。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

todo_task_node_tree-0.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

todo_task_node_tree-0.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file todo_task_node_tree-0.1.0.tar.gz.

File metadata

  • Download URL: todo_task_node_tree-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for todo_task_node_tree-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5055bc58bea8e5ae997e1360c06b18caf488a4ea51f5f1b2bcf443cb0efff66a
MD5 26c169cc2291f42c68c13d893753b8e1
BLAKE2b-256 3b68012daf56fd7ab81cd60b9347d48bbdf783b65bf7ef934e0554581ecf169e

See more details on using hashes here.

File details

Details for the file todo_task_node_tree-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for todo_task_node_tree-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ac31521e4cb8a8951ddde8479cb4baefb29ef4e39a20903acc041179013f911
MD5 bfbae9b494eaa64daaa0807f635cb577
BLAKE2b-256 1887f0aaa0104f781ad3992efe659047a88c59131777f7fa64fcdfe5ce84d707

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page