This commit was merged in pull request #105.
This commit is contained in:
@@ -105,8 +105,8 @@ well-formed version of the same bug:
|
||||
|
||||
> **Title:** `done` command crashes on an out-of-range or non-integer index
|
||||
>
|
||||
> **Context:** `python cli.py done 99` on a list with 3 tasks raises an uncaught `IndexError` and
|
||||
> dumps a traceback. `python cli.py done abc` raises `ValueError`. Either way the user sees a stack
|
||||
> **Context:** `python3 cli.py done 99` on a list with 3 tasks raises an uncaught `IndexError` and
|
||||
> dumps a traceback. `python3 cli.py done abc` raises `ValueError`. Either way the user sees a stack
|
||||
> trace instead of a helpful message.
|
||||
>
|
||||
> **Acceptance criteria:**
|
||||
@@ -264,7 +264,7 @@ plenty it still can't do. Because it's carried forward across modules, skip anyt
|
||||
already built (a `delete` command, task priorities) and pick work that's genuinely still missing.
|
||||
Good candidates:
|
||||
|
||||
1. **A bug**: `python cli.py done 99` (an out-of-range index) and `python cli.py done abc` (a
|
||||
1. **A bug**: `python3 cli.py done 99` (an out-of-range index) and `python3 cli.py done abc` (a
|
||||
non-integer) both crash with an uncaught traceback. Run them and watch.
|
||||
2. **A small, patterned feature**: an `undone <index>` command that clears a task's done flag,
|
||||
mirroring the existing `done` command (it's the inverse).
|
||||
|
||||
@@ -18,16 +18,16 @@
|
||||
|
||||
## Context / problem
|
||||
|
||||
`python cli.py done 99` on a list with 3 tasks raises an uncaught `IndexError` and dumps a Python
|
||||
traceback. `python cli.py done abc` raises `ValueError` the same way. The user sees a stack trace
|
||||
`python3 cli.py done 99` on a list with 3 tasks raises an uncaught `IndexError` and dumps a Python
|
||||
traceback. `python3 cli.py done abc` raises `ValueError` the same way. The user sees a stack trace
|
||||
instead of a helpful message, and the process exits as if it crashed.
|
||||
|
||||
Reproduce:
|
||||
|
||||
```
|
||||
python cli.py add "first"
|
||||
python cli.py done 99 # IndexError traceback
|
||||
python cli.py done abc # ValueError traceback
|
||||
python3 cli.py add "first"
|
||||
python3 cli.py done 99 # IndexError traceback
|
||||
python3 cli.py done abc # ValueError traceback
|
||||
```
|
||||
|
||||
## Acceptance criteria
|
||||
@@ -61,7 +61,7 @@ command, which already takes an index and flips a task's state; this is simply i
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
- [ ] `python cli.py undone <index>` clears the done flag on the task at that index and saves.
|
||||
- [ ] `python3 cli.py undone <index>` clears the done flag on the task at that index and saves.
|
||||
- [ ] `undone` with an out-of-range or non-integer index prints a clear error and exits non-zero
|
||||
(same behavior as the fixed `done`, see Issue 1).
|
||||
- [ ] `list` after `undone` shows that task as not done (`[ ]`).
|
||||
|
||||
@@ -15,11 +15,11 @@ This is the running example for **Module 1** (where you feel the copy-paste prob
|
||||
## Run it
|
||||
|
||||
```bash
|
||||
python cli.py add "read module 1"
|
||||
python cli.py add "set up my editor"
|
||||
python cli.py list
|
||||
python cli.py done 0
|
||||
python cli.py list
|
||||
python3 cli.py add "read module 1"
|
||||
python3 cli.py add "set up my editor"
|
||||
python3 cli.py list
|
||||
python3 cli.py done 0
|
||||
python3 cli.py list
|
||||
```
|
||||
|
||||
Requires Python 3.10+ (it uses `list[Task]` style type hints). No third-party packages.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"""Tiny command-line front end for the demo task app.
|
||||
|
||||
Run it:
|
||||
python cli.py add "write the lesson"
|
||||
python cli.py list
|
||||
python3 cli.py add "write the lesson"
|
||||
python3 cli.py list
|
||||
|
||||
State is kept in tasks.json next to this file. It's intentionally minimal; the point of this app
|
||||
is to be a realistic-but-small thing you change with an AI, not a product.
|
||||
@@ -31,7 +31,7 @@ def save(tlist: TaskList) -> None:
|
||||
def main(argv: list[str]) -> int:
|
||||
tlist = load()
|
||||
if not argv:
|
||||
print("usage: python cli.py [add <title> | list | done <index> | count | delete <index>]")
|
||||
print("usage: python3 cli.py [add <title> | list | done <index> | count | delete <index>]")
|
||||
return 1
|
||||
|
||||
command = argv[0]
|
||||
|
||||
Reference in New Issue
Block a user