fish completion: use literal tabs in sed calls

sed on OS X does not understand \t. Therefore, replace all \t's with
literal tabs.
This commit is contained in:
Johannes Wienke 2015-05-17 00:21:06 +02:00 committed by Paul Beckingham
parent daf56db8ec
commit db0cb5a555
3 changed files with 9 additions and 4 deletions

View file

@ -119,6 +119,7 @@ The following submitted code, packages or analysis, and deserve special thanks:
Oota Toshiya Oota Toshiya
ribbon ribbon
Daniel Shahaf Daniel Shahaf
Johannes Wienke
Thanks to the following, who submitted detailed bug reports and excellent Thanks to the following, who submitted detailed bug reports and excellent
suggestions: suggestions:

View file

@ -47,6 +47,8 @@
(thanks to Denis Kasak). (thanks to Denis Kasak).
- TW-1615 Japanese translation for Taskwarrior(150513) (thanks to ribbon). - TW-1615 Japanese translation for Taskwarrior(150513) (thanks to ribbon).
- TW-1617 Can't search for multi-word project (thanks to Audrey Easterday). - TW-1617 Can't search for multi-word project (thanks to Audrey Easterday).
- TW-1619 fish completion contain backspaces in fish master version (thanks to
Johannes Wienke₎.
- TW-1622 Duration UDA can't take an algebraic expression (thanks to Jeremy John - TW-1622 Duration UDA can't take an algebraic expression (thanks to Jeremy John
Reeder). Reeder).
- TW-1626 Wrong wait date (thanks to Andrea Rizzi). - TW-1626 Wrong wait date (thanks to Andrea Rizzi).

View file

@ -55,6 +55,8 @@
# #
# http://www.opensource.org/licenses/mit-license.php # http://www.opensource.org/licenses/mit-license.php
# NOTE: remember that sed on OS X is different in some aspects. E.g. it does
# not understand \t for tabs.
# convinience functions # convinience functions
@ -74,7 +76,7 @@ end
function __fish.task.zsh function __fish.task.zsh
set -q argv[2]; and set task_argv $argv[2..-1] set -q argv[2]; and set task_argv $argv[2..-1]
task _zsh$argv[1] $task_argv | sed 's/:/\t/' task _zsh$argv[1] $task_argv | sed 's/:/ /'
end end
@ -141,7 +143,7 @@ function __fish.task.token_clean
end end
function __fish.task.list.attr_name function __fish.task.list.attr_name
task _columns | sed 's/$/:\tattribute/g' task _columns | sed 's/$/: attribute/g'
# BUG: doesn't support file completion # BUG: doesn't support file completion
echo rc echo rc
end end
@ -149,7 +151,7 @@ end
function __fish.task.list.attr_value function __fish.task.list.attr_value
set token (commandline -ct | cut -d ':' -f 1 | cut -d '.' -f 1 | __fish.task.token_clean) set token (commandline -ct | cut -d ':' -f 1 | cut -d '.' -f 1 | __fish.task.token_clean)
if test -n $token if test -n $token
set attr_names (__fish.task.list.attr_name | sed 's/:\t/\t/g' | grep '^'$token | cut -d ' ' -f 1) set attr_names (__fish.task.list.attr_name | sed 's/: / /g' | grep '^'$token | cut -d ' ' -f 1)
for attr_name in $attr_names for attr_name in $attr_names
if test -n $attr_name if test -n $attr_name
__fish.task.list.attr_value_by_name $attr_name __fish.task.list.attr_value_by_name $attr_name
@ -250,7 +252,7 @@ function __fish.task.list.tag
end end
function __fish.task.list.task function __fish.task.list.task
__fish.task.zsh ids | sed -E 's/^(.*)\t(.*)$/\2\ttask [id = \1]/g' __fish.task.zsh ids | sed -E 's/^(.*) (.*)$/\2 task [id = \1]/g'
end end
function __fish.task.list function __fish.task.list