mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-20 18:18:47 +08:00
Fix abook
completions
This commit is contained in:
parent
401e5d1f6b
commit
eba099bf77
|
@ -1,15 +1,27 @@
|
||||||
|
|
||||||
function __fish_complete_abook_formats --description 'Complete abook formats'
|
function __fish_complete_abook_formats --description 'Complete abook formats'
|
||||||
set -l pat
|
abook --formats | while read -l x
|
||||||
|
switch $x
|
||||||
|
case "input formats:"
|
||||||
|
set format input
|
||||||
|
case "output formats:"
|
||||||
|
set format output
|
||||||
|
case "query-compatible output formats:"
|
||||||
|
set format ignore
|
||||||
|
end
|
||||||
|
set --append "$format" (string replace -rf '\t(.*\t.*)' '$1' -- $x)
|
||||||
|
end
|
||||||
switch $argv[1]
|
switch $argv[1]
|
||||||
case in
|
case in
|
||||||
set pat '/output:/,$d; /input:\|^$/d'
|
for l in $input
|
||||||
|
echo $l
|
||||||
|
end
|
||||||
case out
|
case out
|
||||||
set pat '/input:/,/output:/d; /^$/d'
|
for l in $output
|
||||||
|
echo $l
|
||||||
|
end
|
||||||
case '*'
|
case '*'
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
abook --formats | sed -e $pat -e 's/^\s\+//'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
complete -c abook -s h -d 'Show usage'
|
complete -c abook -s h -d 'Show usage'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user