2019-08-04 10:43:15 +08:00
|
|
|
function __fish_complete_abook_formats --description 'Complete abook formats'
|
2020-03-21 14:56:35 +08:00
|
|
|
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
|
2019-08-04 10:43:15 +08:00
|
|
|
switch $argv[1]
|
|
|
|
case in
|
2020-03-21 14:56:35 +08:00
|
|
|
for l in $input
|
|
|
|
echo $l
|
|
|
|
end
|
2019-08-04 10:43:15 +08:00
|
|
|
case out
|
2020-03-21 14:56:35 +08:00
|
|
|
for l in $output
|
|
|
|
echo $l
|
|
|
|
end
|
2019-08-04 10:43:15 +08:00
|
|
|
case '*'
|
|
|
|
return 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-06-16 08:30:10 +08:00
|
|
|
complete -c abook -s h -d 'Show usage'
|
|
|
|
complete -c abook -s C -l config -d 'Use an alternative configuration file' -r
|
2019-05-05 18:53:09 +08:00
|
|
|
complete -c abook -l datafile -d 'Use an alternative addressbook file' -r
|
|
|
|
complete -c abook -l mutt-query -d 'Make a query for mutt' -x
|
|
|
|
complete -c abook -l add-email -d 'Read email message from stdin and add the sender'
|
|
|
|
complete -c abook -l add-email-quiet -d 'Same as --add-email. Without confirmation'
|
|
|
|
complete -c abook -l convert -d 'Convert address book files'
|
2012-06-16 08:30:10 +08:00
|
|
|
|
|
|
|
set -l convert 'contains -- --convert (commandline -po)'
|
2019-05-05 18:53:09 +08:00
|
|
|
complete -c abook -l informat -d 'Input file format' -xa '(__fish_complete_abook_formats in)' -n $convert
|
|
|
|
complete -c abook -l outformat -d 'Output file format' -xa '(__fish_complete_abook_formats out)' -n $convert
|
|
|
|
complete -c abook -l infile -d 'Input file (default: stdin)' -r -n $convert
|
|
|
|
complete -c abook -l outfile -d 'Output file (default: stdout)' -r -n $convert
|
2012-06-16 08:30:10 +08:00
|
|
|
|
2019-05-05 18:53:09 +08:00
|
|
|
complete -c abook -l formats -d 'Print available formats'
|