completion: Add bash completion for contexts

This commit is contained in:
Tomas Babej 2015-02-26 21:28:01 +01:00 committed by Paul Beckingham
parent aa8cd54142
commit 3b9d88a87b

View file

@ -68,6 +68,12 @@ _task_offer_projects() {
COMPREPLY=( $(compgen -W "$($taskcommand _projects)" -- ${cur/*:/}) ) COMPREPLY=( $(compgen -W "$($taskcommand _projects)" -- ${cur/*:/}) )
} }
_task_offer_contexts() {
COMPREPLY=( $(compgen -W "$($taskcommand _context) define delete list none show" -- $cur) )
}
_task_context_alias=$($taskcommand show | grep alias.*context | cut -d' ' -f1 | cut -d. -f2)
_task() _task()
{ {
local cur prev opts base local cur prev opts base
@ -91,6 +97,10 @@ _task()
opts="$commands_aliases $($taskcommand _columns)" opts="$commands_aliases $($taskcommand _columns)"
case "${prev}" in case "${prev}" in
$_task_context_alias|cont|conte|contex|context)
_task_offer_contexts
return 0
;;
:) :)
case "${prev2}" in case "${prev2}" in
pri|prior|priori|priorit|priority) pri|prior|priori|priorit|priority)