A simple command-line todo list application built with Node.js.
- Node.js installed on your system
- Clone the repository
git clone https://github.com/0xlam/todo-cli.git
cd todo-cli- Install dependencies
npm install- Run the application:
npm startBy default, tasks are stored in tasks.json. You can specify a different file using the -f or --file option:
npm start -- --file mytasks.json
npm start -- -f mytasks.jsonAlternatively, you can run directly without npm:
node src/cli/app.js --file mytasks.json
node src/cli/app.js -f mytasks.json| Command | Description |
|---|---|
add <task text> |
Add a new task |
list |
Show all tasks |
done <id>[,id2,...] |
Mark one or more tasks as completed |
undo <id>[,id2,...] |
Mark one or more tasks as not completed |
remove <id>[,id2,...] |
Delete one or more tasks |
edit <id> <new text> |
Edit task text |
search <text> |
Search tasks by keyword |
priority <id>[,id2,...] <level> |
Set or remove task priority |
clear |
Delete all tasks |
cls |
Clear the terminal screen |
stats |
Show task statistics |
help |
Show available commands |
exit |
Close the application |
Note:
<level>can below,medium,high, ornone(usenoneto remove priority).
You can use these shorter aliases instead of full command names:
| Alias | Full Command |
|---|---|
ls |
list |
q |
exit |
h |
help |
c |
clear |
st |
stats |
a |
add |
e |
edit |
f |
filter |
d |
done |
rm |
remove |
u |
undo |
se |
search |
p |
priority |
Example: todo> a Buy milk works the same as todo> add Buy milk.
todo> add Buy groceries --prio high
# Task added successfully: [1] Buy groceries [priority: high]
todo> add Walk the dog
# Task added successfully: [2] Walk the dog
todo> add Write report --prio medium
# Task added successfully: [3] Write report [priority: medium]
todo> list
# Your tasks:
# ---------------------------
# [1] [ ] Buy groceries [high]
# [2] [ ] Walk the dog
# [3] [ ] Write report [medium]
# ---------------------------
todo> done 1,3
# Task marked as completed: [1] Buy groceries
# Task marked as completed: [3] Write report
todo> priority 2 high
# Priority for task [2] set to high.
todo> list --status done
# Your tasks:
# ---------------------------
# [1] [x] Buy groceries [high]
# [3] [x] Write report [medium]
# ---------------------------
todo> list --status pending --priority high
# Your tasks:
# ---------------------------
# [2] [ ] Walk the dog [high]
# ---------------------------
todo> stats
# Total: 3 | Completed: 2 | Pending: 1
todo> exit
# Saving tasks...
# Saved 3 task(s) to tasks.json.
# Goodbye.- Tasks are stored in a file (default
tasks.json). - Task IDs restart after
clear. - Use
-f <filename>to change the task file.
- Improve output formatting for better readability.