- Support for project names (thanks to John Florian)
- Completes tags and project names for any command,
not just list variants (thanks to John Florian)
- bash-completion now completes tags for removal using '-'
- internal completion list compiled by using underscore
variants of corresponding commands
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
# The routines will do completion of:
|
# The routines will do completion of:
|
||||||
#
|
#
|
||||||
# *) task subcommands
|
# *) task subcommands
|
||||||
|
# *) project names
|
||||||
# *) tag names
|
# *) tag names
|
||||||
#
|
#
|
||||||
# To use these routines:
|
# To use these routines:
|
||||||
@@ -47,6 +48,14 @@
|
|||||||
# http://taskwarrior.org
|
# http://taskwarrior.org
|
||||||
#
|
#
|
||||||
|
|
||||||
|
_task_get_projects() {
|
||||||
|
task _projects
|
||||||
|
}
|
||||||
|
|
||||||
|
_task_get_tags() {
|
||||||
|
task _tags
|
||||||
|
}
|
||||||
|
|
||||||
_task()
|
_task()
|
||||||
{
|
{
|
||||||
local cur prev opts base
|
local cur prev opts base
|
||||||
@@ -57,14 +66,23 @@ _task()
|
|||||||
|
|
||||||
opts="active add annotate append calendar color completed delete done duplicate edit export ghistory help history import info list long ls newest next oldest overdue projects start stats stop summary tags timesheet undelete undo version"
|
opts="active add annotate append calendar color completed delete done duplicate edit export ghistory help history import info list long ls newest next oldest overdue projects start stats stop summary tags timesheet undelete undo version"
|
||||||
|
|
||||||
case "${prev}" in
|
case "${cur}" in
|
||||||
ls|list|long)
|
pro*:*)
|
||||||
if [[ ${cur} == +* ]] ; then
|
local projects=$(_task_get_projects)
|
||||||
local tags=$( task tags | egrep -v 'tags|^$'|sed 's/^/+/' )
|
local partial_project="${cur/*:/}"
|
||||||
COMPREPLY=( $(compgen -W "${tags}" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "${projects}" -- ${partial_project}) )
|
||||||
return 0
|
return 0
|
||||||
fi
|
;;
|
||||||
;;
|
+*)
|
||||||
|
local tags=$(_task_get_tags | sed 's/^/+/')
|
||||||
|
COMPREPLY=( $(compgen -W "${tags}" -- ${cur}) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
local tags=$(_task_get_tags | sed 's/^/-/')
|
||||||
|
COMPREPLY=( $(compgen -W "${tags}" -- ${cur}) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||||
|
|||||||
Reference in New Issue
Block a user