about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2001-04-13 18:42:13 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2001-04-13 18:42:13 +0000
commitd7417bdc0e500fff5f6890c3ee1f70dff54c3f18 (patch)
treee6ac600aaa0d17e38a2515ee474bb4f92541a94d
parent25b8a1a4b1fe09ab4ee0a12ff94d4162352ef9e1 (diff)
downloadzsh-d7417bdc0e500fff5f6890c3ee1f70dff54c3f18.tar.gz
zsh-d7417bdc0e500fff5f6890c3ee1f70dff54c3f18.tar.xz
zsh-d7417bdc0e500fff5f6890c3ee1f70dff54c3f18.zip
add completion for common MUAs and a couple of minor fixes (13982)
-rw-r--r--ChangeLog8
-rw-r--r--Completion/Base/Utility/_multi_parts2
-rw-r--r--Completion/Unix/Command/.distfiles6
-rw-r--r--Completion/Unix/Command/_elm33
-rw-r--r--Completion/Unix/Command/_mail24
-rw-r--r--Completion/Unix/Command/_mutt4
-rw-r--r--Completion/Unix/Command/_ncftp2
-rw-r--r--Completion/Unix/Command/_pine68
8 files changed, 140 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 510e87898..94b730279 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-04-13  Oliver Kiddle  <opk@zsh.org>
+
+	* 13982: Completion/Base/Utility/_multi_parts,
+	Completion/Unix/Command/.distfiles, Completion/Unix/Command/_elm,
+	Completion/Unix/Command/_mail, Completion/Unix/Command/_mutt,
+	Completion/Unix/Command/_ncftp, Completion/Unix/Command/_pine:
+	add completion for common MUAs and a couple of minor fixes
+
 2001-04-13  Wayne Davison  <wayned@users.sourceforge.net>
 
 	* 13981: Src/Modules/zftp.c: Don't define gethostbyname2()
diff --git a/Completion/Base/Utility/_multi_parts b/Completion/Base/Utility/_multi_parts
index 6f6ef12f2..d0e69b990 100644
--- a/Completion/Base/Utility/_multi_parts
+++ b/Completion/Base/Utility/_multi_parts
@@ -7,7 +7,7 @@
 # The parts of words from the array that are separated by the
 # separator character are then completed independently.
 
-local sep pref npref i tmp2 group expl menu pre suf opre osuf cpre
+local sep pref npref i tmp2 group expl menu pre suf opre osuf orig cpre
 local opts sopts matcher imm
 typeset -U tmp1 matches
 
diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles
index 7d82a778f..6d04555ea 100644
--- a/Completion/Unix/Command/.distfiles
+++ b/Completion/Unix/Command/.distfiles
@@ -11,7 +11,7 @@ _compress     _gcc          _killall      _pack         _stty         _yp
 _configure    _gdb          _look         _patch        _su           _zcat
 _cpio         _getconf      _lp           _pbm          _sudo         _zdump
 _cvs          _gnu_generic  _ls           _perl         _tar          _zip
-_dd           _gprof        _lynx         _perldoc      _telnet
-_dict         _grep         _lzop         _prcs         _tiff
-_diff         _gs           _make         _psutils      _tin	_apm
+_dd           _gprof        _lynx         _perldoc      _telnet       _pine
+_dict         _grep         _lzop         _prcs         _tiff         _elm
+_diff         _gs           _make         _psutils      _tin	_apm  _mail
 '
diff --git a/Completion/Unix/Command/_elm b/Completion/Unix/Command/_elm
new file mode 100644
index 000000000..34a30649c
--- /dev/null
+++ b/Completion/Unix/Command/_elm
@@ -0,0 +1,33 @@
+#compdef elm
+
+local curcontext="$curcontext" state line expl suf
+
+_arguments -C -s \
+  '::recipient:->userhost' \
+  '-a[use the arrow pointer regardless]' \
+  '-A+[attach file]:file attachment:_files' \
+  '-c[check the given aliases only]:*:alias' \
+  '-d+[set debug level]:debug level' \
+  '-f+[specify mailbox to load]:mailbox: _mailboxes' \
+  '-h[display help]' \
+  '-i+[specify file to include in message]:include file:_files' \
+  '-m[turn off menu, using more of the screen]' \
+  '-s+[specify a subject]:subject:' \
+  "-t[don't use termcap/terminfo ti/te entries]" \
+  '-V[enable sendmail voyeur mode]' \
+  '-v[display elm version]' \
+  '-w[write .elm/elmrc]' \
+  '-z[start only if new messages]' && return 0
+
+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
diff --git a/Completion/Unix/Command/_mail b/Completion/Unix/Command/_mail
new file mode 100644
index 000000000..7194ebac8
--- /dev/null
+++ b/Completion/Unix/Command/_mail
@@ -0,0 +1,24 @@
+#compdef mail mailx Mail mush zmail
+
+local curcontext="$curcontext" state line expl suf
+
+_arguments -C -s \
+  '(-f -u)*-b[specify a BCC recipient]:BCC recipient:->userhost' \
+  '(-f -u)*-c[specify a CC recipient]:CC recipient:->userhost' \
+  '(-b -c -u -s *)-f+[specify mail folder]:mailbox:_mailboxes' \
+  '(-f -u)-s+[specify a subject]:subject:' \
+  "(-b -c -f -s *)-u+[read specified user's mail]:user:_users" \
+  '(-f -u)*:recipient:->userhost' && return 0
+
+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
diff --git a/Completion/Unix/Command/_mutt b/Completion/Unix/Command/_mutt
index 7898a0527..21e383484 100644
--- a/Completion/Unix/Command/_mutt
+++ b/Completion/Unix/Command/_mutt
@@ -1,12 +1,12 @@
 #compdef mutt
 
-local curcontext="$curcontext" state line suf
+local curcontext="$curcontext" state line expl suf
 typeset -A opt_args
 
 _arguments -C -s \
     '::recipient:->userhost' \
     '*-a[attach file using MIME]:file attachment:_files' \
-    '*-b[specify a BCC recipient]:BCC recepient:->userhost' \
+    '*-b[specify a BCC recipient]:BCC recipient:->userhost' \
     '*-c[specify a CC recipient]:CC recipient:->userhost' \
     '-e+[specify a post-init configuration command]:post-init configuration:' \
     '-f+[specify mailbox to load]:mailbox: _mailboxes' \
diff --git a/Completion/Unix/Command/_ncftp b/Completion/Unix/Command/_ncftp
index 64f2aee31..93de404aa 100644
--- a/Completion/Unix/Command/_ncftp
+++ b/Completion/Unix/Command/_ncftp
@@ -1,6 +1,6 @@
 #compdef ncftp lftp
 
-local bookmarks=$HOME/.$service/bookmarks
+local expl bookmarks=$HOME/.$service/bookmarks
 
 if [[ -f $bookmarks ]]; then
   bookmarks=(${"${(f)$(<$bookmarks)}"%%[[:space:],]*})
diff --git a/Completion/Unix/Command/_pine b/Completion/Unix/Command/_pine
new file mode 100644
index 000000000..bed8a32f3
--- /dev/null
+++ b/Completion/Unix/Command/_pine
@@ -0,0 +1,68 @@
+#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} )
+
+opts=( -h -F -conf -create_lu -pinerc )  # exclusive options
+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 \
+  "($opts $idx $send -bail -k -z -r -p -P *)-h[display help]" \
+  "($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})" \
+  "($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" \
+  "($opts $send)-c+[specify context to apply to -f arg]:number" \
+  "($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" \
+  "($opts $send)-n+[entry in index to begin on]:number" \
+  "($opts $send)-o[open first folder read-only]" \
+  "(-F -h)-r[restricted - can only send mail to oneself]" \
+  "(${opts#-F})-k[force use of function keys]" \
+  "(${opts#-F})-z[allow use of ^Z suspension]" \
+  "(${opts#-F})-p+[use alternate .pinerc file]:alternate pinerc:_files" \
+  "(${opts#-F})-P+[use alternate pine.conf file]:alternate pine.conf:_files" \
+  "(${opts#-F})-bail[exit if pinerc file doesn't already exist]" \
+  '*::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