Skip to content

0xlam/todo-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Todo List CLI

A simple command-line todo list application built with Node.js.

Getting Started

Prerequisites

  • Node.js installed on your system

Installation

  1. Clone the repository
git clone https://github.com/0xlam/todo-cli.git
cd todo-cli
  1. Install dependencies
npm install
  1. Run the application:
npm start

Using a Custom Task File

By 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.json

Alternatively, you can run directly without npm:

node src/cli/app.js --file mytasks.json
node src/cli/app.js -f mytasks.json

Available Commands

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 be low, medium, high, or none (use none to remove priority).

Command Aliases (Shortcuts)

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.

Usage Examples

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.

Notes

  • Tasks are stored in a file (default tasks.json).
  • Task IDs restart after clear.
  • Use -f <filename> to change the task file.

Future Improvements

  • Improve output formatting for better readability.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors