mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-27 10:07:19 +02:00
Taskwarrior tab completion for the fish shell
Signed-off-by: Paul Beckingham <paul@beckingham.net>
This commit is contained in:
parent
91d5448a5a
commit
2c055157e6
3 changed files with 140 additions and 0 deletions
1
AUTHORS
1
AUTHORS
|
@ -25,6 +25,7 @@ The following submitted code, packages or analysis, and deserve special thanks:
|
||||||
Michal Josífko
|
Michal Josífko
|
||||||
Ed Neville
|
Ed Neville
|
||||||
Kevin Owens
|
Kevin Owens
|
||||||
|
Mick Koch
|
||||||
|
|
||||||
Thanks to the following, who submitted detailed bug reports and excellent suggestions:
|
Thanks to the following, who submitted detailed bug reports and excellent suggestions:
|
||||||
Eugene Kramer
|
Eugene Kramer
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
+ Special tags 'nocal', 'nocolor' and 'nonag' are implemented.
|
+ Special tags 'nocal', 'nocolor' and 'nonag' are implemented.
|
||||||
+ The 'tags' command highlights special tags.
|
+ The 'tags' command highlights special tags.
|
||||||
+ The 'stats' and 'info' reports not obey color.alternate.
|
+ The 'stats' and 'info' reports not obey color.alternate.
|
||||||
|
+ New fish shell tab completion script (thanks to Mick Koch).
|
||||||
+ Fixed bug #427, preventing the task edit command to parse annotation
|
+ Fixed bug #427, preventing the task edit command to parse annotation
|
||||||
dates with spaces.
|
dates with spaces.
|
||||||
+ Fixed bug #433, making task command output more consistent.
|
+ Fixed bug #433, making task command output more consistent.
|
||||||
|
|
138
scripts/fish/task.fish
Normal file
138
scripts/fish/task.fish
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
# Task <http://taskwarrior.org> tab completions for the Fish shell
|
||||||
|
# <http://fishshell.org>.
|
||||||
|
#
|
||||||
|
# Copy this script to ~/.config/fish/completions/task.fish, open a new shell,
|
||||||
|
# and enjoy.
|
||||||
|
#
|
||||||
|
# Objects completed:
|
||||||
|
# * Commands
|
||||||
|
# * Projects
|
||||||
|
# * Priorities
|
||||||
|
# * Tags
|
||||||
|
# * Attribute names and modifiers
|
||||||
|
#
|
||||||
|
# License:
|
||||||
|
# Copyright 2009 Mick Koch <kchmck@gmail.com>
|
||||||
|
#
|
||||||
|
# This script is free software. It comes without any warranty, to the extent
|
||||||
|
# permitted by applicable law. You can redistribute it and/or modify it under
|
||||||
|
# the terms of the Do What The Fuck You Want To Public License, Version 2, as
|
||||||
|
# published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
|
||||||
|
# details.
|
||||||
|
|
||||||
|
function __fish.task.bare
|
||||||
|
test (count (commandline -c -o)) -eq 1
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish.task.complete
|
||||||
|
complete -c task -u $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish.task.head
|
||||||
|
task _ids
|
||||||
|
task _commands
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish.task.attrs
|
||||||
|
echo project
|
||||||
|
echo priority
|
||||||
|
echo due
|
||||||
|
echo recur
|
||||||
|
echo until
|
||||||
|
echo limit
|
||||||
|
echo wait
|
||||||
|
echo rc
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish.task.mods
|
||||||
|
echo before
|
||||||
|
echo after
|
||||||
|
echo over
|
||||||
|
echo under
|
||||||
|
echo none
|
||||||
|
echo is
|
||||||
|
echo isnt
|
||||||
|
echo has
|
||||||
|
echo hasnt
|
||||||
|
echo startswith
|
||||||
|
echo endswith
|
||||||
|
echo word
|
||||||
|
echo noword
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish.task.combos
|
||||||
|
echo $argv[1]:$argv[2]
|
||||||
|
|
||||||
|
for mod in (__fish.task.mods)
|
||||||
|
echo $argv[1].$mod:$argv[2]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish.task.combos.simple
|
||||||
|
__fish.task.combos $argv ""
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish.task.projects
|
||||||
|
__fish.task.combos.simple project
|
||||||
|
|
||||||
|
for project in (task _projects)
|
||||||
|
__fish.task.combos project $project
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish.task.priorities
|
||||||
|
__fish.task.combos.simple priority
|
||||||
|
|
||||||
|
for priority in H M L
|
||||||
|
__fish.task.combos priority $priority
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish.task.rc
|
||||||
|
echo rc:
|
||||||
|
|
||||||
|
for value in (task _config)
|
||||||
|
echo rc.$value:
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish.task.tags
|
||||||
|
for tag in (task _tags)
|
||||||
|
echo +$tag
|
||||||
|
echo -$tag
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish.task.match
|
||||||
|
__fish.task.attrs | grep \^(echo $argv | sed -E "s/(\w+).+/\1/")
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish.task.attr
|
||||||
|
for attr in (__fish.task.match $argv)
|
||||||
|
switch $attr
|
||||||
|
case project
|
||||||
|
__fish.task.projects
|
||||||
|
case priority
|
||||||
|
__fish.task.priorities
|
||||||
|
case rc
|
||||||
|
__fish.task.rc
|
||||||
|
case "*"
|
||||||
|
__fish.task.combos.simple $attr
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish.task.body
|
||||||
|
set token (commandline -ct)
|
||||||
|
|
||||||
|
if test -n $token
|
||||||
|
__fish.task.attr $token
|
||||||
|
else
|
||||||
|
__fish.task.attrs
|
||||||
|
end
|
||||||
|
|
||||||
|
__fish.task.tags
|
||||||
|
end
|
||||||
|
|
||||||
|
__fish.task.complete -f -n __fish.task.bare -a "(__fish.task.head)"
|
||||||
|
__fish.task.complete -f -n "not __fish.task.bare" -a "(__fish.task.body)"
|
Loading…
Add table
Add a link
Reference in a new issue