Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

todoman completion


I'm trying to get the bundled zsh completion function [1] for todoman
[2] to work on my system but I don't seem to be able to do so.

Specifically, I'm currently attempting to make `todo list<Tab>` complete
the available lists. The problem I am stuck at seems to be that the cache
policy function `__todo_lists_cache_policy` at line 127 is never called
and I cannot figure out why: the cache policy setting at lines 147-151
seems correct and yet the call to `_cache_invalid` at line 153 does not
redirect to `__todo_lists_cache_policy` at all. If I place the function
name there directly, everything works as expected.

Could you please point me to the cause of this issue?

I attach a patch of other changes I have had to make for the completion
to work.

[1] https://github.com/pimutils/todoman/blob/main/contrib/completion/zsh/_todo
[2] https://github.com/pimutils/todoman

Thank you,
diff --git a/contrib/completion/zsh/_todo b/contrib/completion/zsh/_todo
index b9bbe8a..8951906 100644
--- a/contrib/completion/zsh/_todo
+++ b/contrib/completion/zsh/_todo
@@ -32,7 +32,7 @@ __color_mode(){
 # }}}
 # {{{ general helper: set variable of path to configuration file
-	todoman_configuration_file=${XDG_CONFIG_DIR:-${HOME}/.config}/todoman/todoman.conf
+	todoman_configuration_file=${XDG_CONFIG_DIR:-${HOME}/.config}/todoman/config.py
 	if [[ -f $todoman_configuration_file ]]; then
 		return 0
@@ -43,7 +43,7 @@ __todo_set_conf(){
 # {{{ general helper: set variable main.path from configuration file
 	if __todo_set_conf; then
-		tasks_lists_path="$(sed -n -e 's/^[^#]\s*path\s*=\s*\(.*\)$/\1/p' $todoman_configuration_file 2>/dev/null)"
+		tasks_lists_path="$(sed -n -e "s/^\\s*path\\s*=\\s*['\"]\\(.*\\)['\"]$/\\1/p" $todoman_configuration_file 2>/dev/null)"
 		# the eval echo is needed since the path may contain ~ which should be evalueated to $HOME
 		tasks_lists_dir="$(eval echo ${tasks_lists_path%/\**})"
 		if [[ -z "${tasks_lists_path}" || ! -d "${tasks_lists_dir}" ]]; then

Messages sorted by: Reverse Date, Date, Thread, Author