From 9623f77af842f2ac974830292c8cc98d6f81e374 Mon Sep 17 00:00:00 2001 From: Ingo Karkat Date: Wed, 30 Oct 2024 08:28:09 +0100 Subject: [PATCH] ENH: Reuse the todo.sh alias for completion Having to define a completion function wrapper is cumbersome. I had seen the trick of simply using ${COMP_WORDS[0]} (i.e. the used todo.sh command itself) from Paul Mansfield (https://github.com/the1ts/todo.txt-plugins/blob/develop/bash_completion/todo.txt#L7), which neatly avoids this. By keeping the _todo_sh variable, this is a one-line change and it still allows the old way of using the override in a wrapper function. (So users aren't forced to change their customizations when upgrading.) Tests are adapted to verify that the alias is used, and still verify the wrapper function as well. The documentation is simplified because there's normally no need for the completion wrapper function. --- tests/t6090-completion-aliases.sh | 13 ++++++++++--- todo_completion | 26 +++++++++----------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/tests/t6090-completion-aliases.sh b/tests/t6090-completion-aliases.sh index 7e9f00f..f136ee7 100755 --- a/tests/t6090-completion-aliases.sh +++ b/tests/t6090-completion-aliases.sh @@ -46,15 +46,22 @@ test_todo_session 'todo 1 and 2 contexts' <