In your ~/.zshrc or ~/.bashrc configuration file, add the following instructions:
- An environment variable to store a file where the task list will be stored;
export TODO="${HOME}/todo.txt"tla() { [ $# -eq 0 ] && cat $TODO || (echo "$(echo $* | md5sum | cut -c 1-4) ππΌ $*" >> $TODO && cat $TODO) ;}
tlr() { sed -i '' "/^$*/d" $TODO && cat $TODO ;}
tl() { cat $TODO ;}
tlc() { cat /dev/null > $TODO ;}tla(or Todo List Add) is the function responsible for adding items to the list. It captures the string given as input, if provided, generates an md5 and adds its first 4 digits to the beginning of the line to be used as an identifier. If nothing is passed, it just shows the current listing;tlr(or todo list remove) is the function responsible for removing items from the list. For this, the md5 identifier (4 digits) is used to identify the line and remove it from the file;tl(or todo list) serves only as a show. It shows how the list is. It's similar to executingtlawithout parameters;tlc(or todo list clear) serves to clear the entire list at once, basically deletes the entire file at once.
The main commands are tla and tlr, the others are just auxiliary and are not as important for the app to function.
At the end of each addition or removal command, the current state of the list is shown.
β ~ tl
β ~ tla test 0
# 0e57 ππΌ test 0
β ~ tla test 1
# 0e57 ππΌ test 0
# 2490 ππΌ test 1
β ~ tla test 2
# 0e57 ππΌ test 0
# 2490 ππΌ test 1
# b0b3 ππΌ test 2
β ~ tlr 2490
# 0e57 ππΌ test 0
# b0b3 ππΌ test 2
β ~ tl
# 0e57 ππΌ test 0
# b0b3 ππΌ test 2
β ~ tlc
β ~ tl