#  Copyright (C) 2003 Ingo K"ohne
#  
#  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.,
#  59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

. ../include/common

cmd=mutt

optcomplete -f  $cmd a
optcomplete -C "$xpc_mail_address_C #"  $cmd b
optcomplete -C "$xpc_mail_address_C #"  $cmd c
optcomplete -c  $cmd e
optcomplete -m filename -C $'
case "$XPC_PATTERN" in
+*) local ch=\'+\' ;;
=*) local ch=\'=\' ;;
*)  compgen -f -- "$XPC_PATTERN"; return ;;
esac 
eval local $(mutt -Q folder) 2>&1 | :
test -n "$folder" || folder=${HOME:-/home/$(whoami)}/Mail 
folder=${folder%/}/
compgen -f -- $folder"${XPC_PATTERN#$ch}" | sed "s@^$folder@$ch@"
#' $cmd f
optcomplete -f  $cmd F
optcomplete  $cmd h
optcomplete -f  $cmd H
optcomplete -f  $cmd i
optcomplete -W 'mbox MMDF MH Maildir'  $cmd m
optcomplete  $cmd n
optcomplete  $cmd p
optcomplete  $cmd R
optcomplete -m arg_required  $cmd s
optcomplete  $cmd v
optcomplete  $cmd x
optcomplete  $cmd y
optcomplete  $cmd z
optcomplete  $cmd Z
optcomplete -C "$xpc_mail_address_C #"  $cmd NONOPT

optcomplete -m short,getoptparse  $cmd

complete -F xpcompfunc  $cmd

unset cmd ${!xpc_*}
