Skip to content

About

一个vibe coding工程化练手项目

Resources

Stars

6 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Todo CLI

一个轻量级的命令行任务管理工具,使用 Python 标准库构建,零外部依赖。

功能特性

  • 添加任务 - 快速记录待办事项
  • 列出任务 - 查看所有任务及完成状态
  • 完成任务 - 标记任务为已完成
  • 数据持久化 - 自动保存到 JSON 文件

系统要求

  • Python 3.8+
  • 无需安装任何外部依赖

使用方法

添加任务

python todo.py add "任务描述"

示例:

python todo.py add "Buy milk"
python todo.py add "Write report"

列出所有任务

python todo.py list

输出示例:

1. [ ] Buy milk
2. [x] Write report
3. [ ] Call mom
  • [ ] 表示未完成
  • [x] 表示已完成

标记任务完成

python todo.py done <任务ID>

示例:

python todo.py done 1

查看帮助

python todo.py --help
python todo.py add --help

项目结构

my-todo-app/
├── todo/                    # 主应用包
│   ├── __init__.py         # 包标识
│   ├── models.py           # 数据模型
│   ├── storage.py          # 数据持久化
│   ├── cli.py              # 命令行解析
│   └── __main__.py         # 程序入口
├── todo.py                  # 便捷入口脚本
├── todos.json               # 数据文件(运行时生成)
└── README.md

数据存储

任务数据保存在当前目录的 todos.json 文件中:

{
  "tasks": [
    {"id": 1, "description": "Buy milk", "done": false},
    {"id": 2, "description": "Write report", "done": true}
  ]
}

错误处理

场景 提示信息
任务 ID 不存在 Error: Task not found
任务描述为空 Error: Task description required
无效命令 显示帮助信息

替代运行方式

也可以作为 Python 模块运行:

python -m todo add "Task description"
python -m todo list
python -m todo done 1

About

一个vibe coding工程化练手项目

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages