ToDo is a lightweight terminal note-taking utility written in Bash with support for both Bash and Zsh. It is designed to quickly create, edit, view, back up, and restore a plain text note file directly from the terminal.
The script automatically creates a backup before appending new notes, supports graceful cancellation during input, and provides simple recovery from the most recent backup if required.
- Interactive note entry from the terminal.
- Automatic backup before modifying the note file.
- Edit notes using the first available supported editor (
nano,nvim,vim,vi,emacs). - Display the full note file or only the most recent entries.
- Restore the note file from the latest backup.
- Compatible with both Bash and Zsh.
git clone https://github.com/FMallon/ToDo && cd ToDo && chmod +x todo.sh && sudo ln -sf "$(pwd)/todo.sh" /usr/local/bin/todotodo <option>
| Option | Description |
|---|---|
-a |
Append a new note to TODO.txt. |
-e |
Open TODO.txt in your preferred text editor. |
-d |
Display the contents of TODO.txt. |
-t |
Display the last ten lines of TODO.txt. |
-rf |
Restore TODO.txt from the backup file. |
-h, --help |
Display the help menu. |
todo -aType as many lines as required.
- Press Enter after each line.
- Press Ctrl+D to finish and append the text.
- Press Ctrl+C at any time to cancel the operation.
A backup of the current note file is automatically created before the append operation begins.
todo -eThe script automatically selects the first supported editor available on your system.
Display the complete note file:
todo -dDisplay only the most recent entries:
todo -ttodo -rfYou will be prompted for confirmation before the current note file is overwritten.
- Notes are stored as plain text in
TODO.txt. - A backup file (
TODO.txt.bk) is maintained automatically before appending. - The script is intentionally lightweight and dependency-free.
- Compatible with both Bash and Zsh.
| Code | Description |
|---|---|
1 |
Unsupported shell environment |
2 |
Required file does not exist |
3 |
Failed to create TODO.txt |
4 |
No supported text editor found |
5 |
Failed to launch text editor |
6 |
Failed to create TODO.txt backup |
7 |
Failed to append content to TODO.txt |
8 |
Failed to read the tail of TODO.txt |
9 |
Input failure during restore confirmation |
10 |
Failed to restore TODO.txt from backup |
11 |
Restore process cancelled by user |
12 |
Append process cancelled by user |
13 |
Invalid command argument |
14 |
Invalid number of arguments |