1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
Description: use todoman binary in bash-completion
Author: Félix Sipma <felix@debian.org>
Last-Update: 2023-07-23
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/contrib/completion/bash/_todo
+++ b/contrib/completion/bash/_todo
@@ -1,22 +1,22 @@
-_todo_get_ids()
+_todoman_get_ids()
{
local pattern='^\s*"id": \([0-9]\+\),'
- todo --porcelain list | grep -o "${pattern}" | sed -e "s/${pattern}/\1/" | sort
+ todoman --porcelain list | grep -o "${pattern}" | sed -e "s/${pattern}/\1/" | sort
}
-_todo_get_lists()
+_todoman_get_lists()
{
local pattern='^\s*"list": "\(.*\)",'
- todo --porcelain list | grep -o "${pattern}" | sed -e "s/${pattern}/\1/" | sort | uniq
+ todoman --porcelain list | grep -o "${pattern}" | sed -e "s/${pattern}/\1/" | sort | uniq
}
-_todo_get_locations()
+_todoman_get_locations()
{
local pattern='^\s*"location": \(.*\)\+,'
- todo --porcelain list | grep -o "${pattern}" | sed -e "s/${pattern}/\1/" | sort | uniq
+ todoman --porcelain list | grep -o "${pattern}" | sed -e "s/${pattern}/\1/" | sort | uniq
}
-_todo_single_dash_options()
+_todoman_single_dash_options()
{
local prev_word=$1
@@ -42,7 +42,7 @@
esac
}
-_todo_double_dash_options()
+_todoman_double_dash_options()
{
local prev_word=$1
@@ -78,7 +78,7 @@
echo " --help"
}
-_todo_complete()
+_todoman_complete()
{
local cur_word prev_word arg_list
@@ -87,9 +87,9 @@
arg_list=""
if [[ ${cur_word} == --* ]] ; then
- arg_list="$(_todo_double_dash_options ${prev_word})"
+ arg_list="$(_todoman_double_dash_options ${prev_word})"
elif [[ ${cur_word} == -* ]] ; then
- arg_list="$(_todo_single_dash_options ${prev_word}) $(_todo_double_dash_options ${prev_word})"
+ arg_list="$(_todoman_single_dash_options ${prev_word}) $(_todoman_double_dash_options ${prev_word})"
else
case ${prev_word} in
-v|--verbosity)
@@ -99,10 +99,10 @@
arg_list="always auto never"
;;
--list)
- arg_list="$(_todo_get_lists)"
+ arg_list="$(_todoman_get_lists)"
;;
--location)
- arg_list="$(_todo_get_locations)"
+ arg_list="$(_todoman_get_locations)"
;;
--priority)
arg_list="none low medium high"
@@ -114,13 +114,13 @@
arg_list=""
;;
cancel|copy|delete|done|edit|move|show)
- arg_list="$(_todo_get_ids)"
+ arg_list="$(_todoman_get_ids)"
;;
flush)
arg_list=""
;;
list)
- arg_list="$(_todo_get_lists)"
+ arg_list="$(_todoman_get_lists)"
;;
new)
arg_list=""
@@ -136,4 +136,4 @@
return 0
}
-complete -F _todo_complete todo
+complete -F _todoman_complete todoman
|