I made this version for my own usage. I merged todo
and fin
commands and added some more functionality.
Usage:
todo feed dog
, create a todo item for feed dog
, to mark as resolved simply type todo feed dog
again. (Auto correct also works.
todo clear
, clear all the todo/done done items.
todo clear-todo
, clear only the todo items.
todo clear-done
, clear only the done items.
I made misc updates to your script to get it working and made a few minor improvements.
Instead of making the user create the ~/TODO/
and ~/TODO/outstanding_tasks
and ~/TODO/completed_tasks
folders,
your script could do that automatically for the user.
mkdir -p
command will make directory if not exist.
mkdir -p ~/TODO/outstanding_tasks
mkdir -p ~/TODO/completed_tasks
I noticed your two soft link examples the operands were not consisent. Inconsistency is the main thing I noticed, so I know one of them is wrong. I believe you want them to be like the below, but confirm ordering. ln -s ~/TODO ~/Google\ Drive/TODO ln -s ~/TODO ~/Dropbox/TODO
ref: https://www.computerhope.com/unix/uln.htm
Note the "fin" command: dope~: fin write\ medium\ post
Then notice the "todo" command: dope~: todo write medium post
You see how the "todo" command did not require you to put in the "\ " for space? It would be nice if that was not required like with todo command. I think the reason it may not have worked for you was a small bug in the fin function. Specifcally when you are identifying the file path name for the todo list item you correctly use this ${TASKS_DIR}"${*}"
. However, in the fin
function you wrote this: mv ${TASKS_DIR}"$1" ${COMPLETED_DIR}
, to move the item, but $1 is not what you want to use, it needs to be: mv ${TASKS_DIR}"$*" ${COMPLETED_DIR}
.
If you do that, I think you can then avoid using "\ " in the fin command.
I suspect that this may also mean you then won't need the COMPREPLY=( "${tmp[@]// /\ }" )
transform in the _fin
function.
This final thought is more of a design thought. But I want to be clear, i really love your implmentation and it's simplifcity. So consider this below as just an extra thought and just for fun.
I just realized an even easier way to handle "fin" function. What if when you print TODOs you add numbers like this:
— — — — — — — — — — — TODO — — — — — — — — — — — —
1. [] write medium post
2. [] publish medium post
— — — — — — — — — — — — — — — — — — — — — — — — —
and then you can just type: fin 1
to mark the first item as finished. This may make it easier to use. The code would be a bit more complex though as you'd want to name files something like TODO/outstanding/1_pick_up_trash
, TODO/outstanding/2_take_shower
. Note the number at the beginning of the file name to help with deleting since mv command could just be something like mv TODO/outstanding/1_* TODO/complete/
text: