Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable separator character to replace ':'. Defaults to '#' #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions reminder.plugin.zsh
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
TODO_SAVE_TASKS_FILE="$HOME/.todo.sav"
TODO_SAVE_COLOR_FILE="$HOME/.todo_color.sav"

# Using '#' because its pretty uncommon to type
# typeset arrays by default use ':' but that means we can't have iTerm2 clickable URLs!
TODO_SEP="${TODO_SEP:-"\#"}"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the default value should still be :, else it will break any existing todo file... Even if I don't know if there is a lot ^^

Suggested change
TODO_SEP="${TODO_SEP:-"\#"}"
TODO_SEP="${TODO_SEP:-":"}"

If you have a good argument against the colon, I am open to change the default to #.
But this would be a breaking change and so must be considered.


# Allow to use colors
colors
typeset -T -x -g TODO_TASKS todo_tasks
typeset -T -x -g TODO_TASKS_COLORS todo_tasks_colors
typeset -T -x -g TODO_TASKS todo_tasks $TODO_SEP
typeset -T -x -g TODO_TASKS_COLORS todo_tasks_colors $TODO_SEP
typeset -a -x -g todo_colors
typeset -i -x -g todo_color_index

Expand Down Expand Up @@ -58,7 +62,7 @@ function todo_task_done {
function _todo_task_done {
load_tasks
if [[ ${#todo_tasks} -gt 0 ]] then
compadd $(echo ${TODO_TASKS} | tr ':' '\n')
compadd $(echo ${TODO_TASKS} | tr "$TODO_SEP" '\n')
fi
}

Expand All @@ -80,4 +84,3 @@ function todo_save {
echo "$TODO_TASKS_COLORS" > $TODO_SAVE_COLOR_FILE
echo "$todo_color_index" >> $TODO_SAVE_COLOR_FILE
}