taskwarrior/scripts/zsh/_task
Paul Beckingham 44fe227595 Product Name Change
- Converted all (appropriate) uses of 'task' to 'taskwarrior'.
2010-08-21 12:31:00 -04:00

62 lines
1.9 KiB
Text

#compdef task
#
# This script is currently unmaintained and was released for an earlier version
# of taskwarrior. We welcome any zsh user that wants to contribute to
# taskwarrior to take a look at this script and either confirm its working
# status or improve it. Please contact us at support@taskwarrior.org if you
# have further questions on how to contribute to taskwarrior.
#
# zsh completion for taskwarrior
#
# Copyright 2009 P.C. Shyamshankar
# All rights reserved.
#
# This script is part of the taskwarrior project.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the
#
# Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor,
# Boston, MA
# 02110-1301
# USA
#
typeset -g _task_cmds
_task_cmds=($(task _commands))
_task() {
_arguments -s -S \
"*::task command:_task_commands"
return 0
}
(( $+functions[_task_commands] )) ||
_task_commands() {
local cmd ret=1
if (( CURRENT == 1 )); then
_describe -t commands 'task command' _task_cmds
else
local curcontext="${curcontext}"
cmd="${_task_cmds[(r)$words[1]:*]%%:*}"
if (( $#cmd )); then
curcontext="${curcontext%:*:*}:task-${cmd}"
_call_function ret _task_${cmd} || _message "No command remaining."
else
_message "Unknown subcommand ${cmd}"
fi
return ret
fi
}