2001-04-13 20:42:13 +02:00
|
|
|
#compdef pine pinef
|
|
|
|
|
|
|
|
local curcontext="$curcontext" state line expl suf
|
|
|
|
local optfile getopts='pine -conf' sortorder lusortorder opts send idx
|
|
|
|
|
|
|
|
if [[ -n $+_cache_pine_options ]]; then
|
|
|
|
for optfile in ~/.pinerc /etc/pine.conf; do
|
|
|
|
if [[ -f $optfile ]]; then
|
|
|
|
getopts="cat $optfile"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
_cache_pine_options=( $($=getopts | sed -n 's/^\([^#]*=\).*/-\1/p') )
|
|
|
|
fi
|
|
|
|
|
|
|
|
sortorder=( {subject,arrival,date,from,size}{,/reverse} )
|
|
|
|
lusortorder=( dont-sort {nickname,fullname}{,-with-lists-last} )
|
|
|
|
|
2001-05-30 13:54:53 +02:00
|
|
|
opts=( -h -v -F -conf -create_lu -pinerc -copy_abook -copy_pinerc) # exclusive options
|
2001-04-13 20:42:13 +02:00
|
|
|
idx=( -f -c -i -I -n -o -sort ) # options used when viewing messages
|
|
|
|
send=( -attach -attachlist -attach_and_delete -url ) # options when sending
|
|
|
|
|
|
|
|
_arguments -C -s \
|
2001-05-30 13:54:53 +02:00
|
|
|
"($opts $idx $send -bail -d -k -z -r -p -P *)-h[display help]" \
|
|
|
|
"($opts $idx $send -bail -d -k -z -r -p -P *)-v[display version information]" \
|
2001-04-13 20:42:13 +02:00
|
|
|
"($opts $idx $send -r *)-F+[specify file to open and page through]:file:_files" \
|
|
|
|
"($opts $idx $send *)-conf[print out fresh global configuration]" \
|
|
|
|
"($opts $idx $send *)-pinerc[put fresh pinerc configuration in file]:file:_files" \
|
|
|
|
"($opts $idx $send *)-create_lu[create .lu from script]:addressbook file:_files:sort order:(${(j: :)lusortorder})" \
|
2001-05-30 13:54:53 +02:00
|
|
|
"($opts $idx $send *)-copy_pinerc:pinerc file:_files:remote folder" \
|
|
|
|
"($opts $idx $send *)-copy_abook:addressbook file:_files:remote folder" \
|
2001-04-13 20:42:13 +02:00
|
|
|
"($opts $idx -url)-attach[go directly into composer with given file]:file:_files" \
|
|
|
|
"($opts $idx -url)-attachlist[go to composer with given files]:file:_files" \
|
|
|
|
"($opts $idx -url)-attach_and_delete[go to composer, attach file, delete when finished]:file:_files" \
|
|
|
|
"($opts $idx $send)-url[open the given URL]:url:->url" \
|
|
|
|
"($opts $send)-f+[specify mailbox to load]:mailbox: _mailboxes" \
|
2001-04-26 16:00:45 +02:00
|
|
|
"($opts $send)-c+[specify context to apply to -f arg]:number:_guard '[0-9]#'" \
|
2001-04-13 20:42:13 +02:00
|
|
|
"($opts $send)-sort[specify sort order of folder]:sort order:(${(j: :)sortorder})" \
|
|
|
|
"($opts $send)-i[go directly to index, bypassing main menu]" \
|
|
|
|
"($opts $send)-I+[specify initial keystrokes to be executed]:keystrokes" \
|
2001-04-26 16:00:45 +02:00
|
|
|
"($opts $send)-n+[entry in index to begin on]:number:_guard '[0-9]#'" \
|
2001-04-13 20:42:13 +02:00
|
|
|
"($opts $send)-o[open first folder read-only]" \
|
2001-05-30 13:54:53 +02:00
|
|
|
"(-F -h -v)-r[restricted - can only send mail to oneself]" \
|
|
|
|
"(-h -v)-d[set debug level]:debug:(0 1 2 3 4 5 6 7 8 9 flush timestamp imap= numfiles= verbose=)" \
|
2002-01-17 19:49:32 +01:00
|
|
|
\(${(j. .)opts:#-F}')-k[force use of function keys]' \
|
|
|
|
\(${(j. .)opts:#-F}')-z[allow use of ^Z suspension]' \
|
|
|
|
\(${(j. .)opts:#-F}')-p+[use alternate .pinerc file]:alternate pinerc:_files' \
|
|
|
|
\(${(j. .)opts:#-F}')-P+[use alternate pine.conf file]:alternate pine.conf:_files' \
|
|
|
|
\(${(j. .)opts:#-F}')-x[use configuration exceptions file]:configuration exceptions file:_files' \
|
|
|
|
\(${(j. .)opts:#-F}")-bail[exit if pinerc file doesn't already exist]" \
|
2001-04-13 20:42:13 +02:00
|
|
|
'*::recipient:->userhost' \
|
|
|
|
${^_cache_pine_options}':option value' && return 0
|
|
|
|
|
|
|
|
if [[ "$state" = url ]]; then
|
|
|
|
if compset -P 'mailto:'; then
|
|
|
|
state=userhost
|
|
|
|
else
|
|
|
|
compadd -S: mailto && return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$state" = userhost ]]; then
|
|
|
|
if compset -P '*@'; then
|
|
|
|
_description hosts expl 'remote host name'
|
|
|
|
_hosts "$expl[@]" && return 0
|
|
|
|
else
|
|
|
|
compset -S '@*' || suf='@'
|
|
|
|
_description users expl 'login name'
|
|
|
|
_users "$expl[@]" -q -S "$suf" && return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
return 1
|