Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

ToDo

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.


Table of Contents


Features

  • 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.

Installation

git clone https://github.com/FMallon/ToDo && cd ToDo && chmod +x todo.sh && sudo ln -sf "$(pwd)/todo.sh" /usr/local/bin/todo

Usage

todo <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.

Appending Notes

todo -a

Type 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.


Editing Notes

todo -e

The script automatically selects the first supported editor available on your system.


Viewing Notes

Display the complete note file:

todo -d

Display only the most recent entries:

todo -t

Restoring From Backup

todo -rf

You will be prompted for confirmation before the current note file is overwritten.


Notes

  • 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.

Return Codes

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

About

A terminal script that quickly allows the User to make note of things with a simple command

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages