From 3b9d88a87b9a0290b4cb29288e2f2cd106fd77a9 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Thu, 26 Feb 2015 21:28:01 +0100 Subject: [PATCH] completion: Add bash completion for contexts --- scripts/bash/task.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/bash/task.sh b/scripts/bash/task.sh index 58881ab06..7c37944cc 100644 --- a/scripts/bash/task.sh +++ b/scripts/bash/task.sh @@ -68,7 +68,13 @@ _task_offer_projects() { COMPREPLY=( $(compgen -W "$($taskcommand _projects)" -- ${cur/*:/}) ) } -_task() +_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() { local cur prev opts base @@ -91,6 +97,10 @@ _task() opts="$commands_aliases $($taskcommand _columns)" case "${prev}" in + $_task_context_alias|cont|conte|contex|context) + _task_offer_contexts + return 0 + ;; :) case "${prev2}" in pri|prior|priori|priorit|priority)