about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDoug Kearns <dkearns@users.sourceforge.net>2005-06-28 17:06:25 +0000
committerDoug Kearns <dkearns@users.sourceforge.net>2005-06-28 17:06:25 +0000
commitf64cc0a2df49b11835cda8a91675014aafc05faf (patch)
tree155accd7aa7f42398081b58355abd31961494cd6
parenta6660cadc66f21a9fcbf1f388f2c163c0561b53a (diff)
downloadzsh-f64cc0a2df49b11835cda8a91675014aafc05faf.tar.gz
zsh-f64cc0a2df49b11835cda8a91675014aafc05faf.tar.xz
zsh-f64cc0a2df49b11835cda8a91675014aafc05faf.zip
21392: update w3m completion for version 0.5.x
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Unix/Command/_w3m119
2 files changed, 93 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index 63c17687f..03fafd9b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-06-28  Doug Kearns  <djkea2@gus.gscit.monash.edu.au>
+
+	* 21392: Completion/Unix/Command/_w3m: update w3m completion for
+	version 0.5.x; add completion for URLs from the bookmarks file,
+	options, charsets, and proxy authentication
+
 2005-06-28  Peter Stephenson  <pws@csr.com>
 
 	* 21391: Src/jobs.c: Restrict passing of signals from foreground
diff --git a/Completion/Unix/Command/_w3m b/Completion/Unix/Command/_w3m
index c8e5ef19d..0ea453841 100644
--- a/Completion/Unix/Command/_w3m
+++ b/Completion/Unix/Command/_w3m
@@ -1,51 +1,106 @@
 #compdef w3m
 
+# w3m version w3m/0.5.1
+
 local curcontext="$curcontext" state line expl ret=1
 typeset -A opt_args
 
 _arguments -C \
-  '-t[tabwidth]:tabwidth:' \
+  '-t[set tab width]:tab width:' \
   '-r[ignore backspace effect]' \
-  '-l[preserved lines]:number of lines:' \
-  '-B[load bookmark]' \
-  '-bookmark:bookmark file:_files' \
-  '-T[content-type]:content type' \
+  '-l[specify number of preserved lines]:number of lines (default 10000):' \
+  '-I[document charset]:charset:->charset' \
+  '-O[display/output charset]:charset:->charset' \
+  '(   -s -j)-e[EUC-JP]' \
+  '(-e    -j)-s[Shift_JIS]' \
+  '(-e -s   )-j[JIS]' \
+  '(-v *)-B[load bookmark]' \
+  '-bookmark[specify bookmark file]:bookmark file:_files' \
+  '-T[specify content-type]:content type:_mime_types' \
   '-m[internet message mode]' \
-  '-v[visual startup mode]' \
+  '(-B *)-v[visual startup mode]' \
   '-M[monochrome display]' \
+  '-N[open URL of command line on each new tab]' \
   '-F[automatically render frame]' \
-  '(-dump_source -dump_head)-dump' \
-  '-cols:column width' \
-  '(-dump -dump_head)-dump_source' \
-  '(-dump -dump_source)-dump_head' \
+  '-cols[specify column width (used with -dump)]:column width' \
+  '-ppc[specify the number of pixels per character (4.0...32.0)]:number of pixels (4.0...32.0):' \
+  '-ppl[specify the number of pixels per line (4.0...64.0)]:number of pixels (4.0...64.0):' \
+  '(      -dump_head -dump_source -dump_both -dump_extra)-dump[dump formatted page into stdout]' \
+  '(-dump            -dump_source -dump_both -dump_extra)-dump_head[dump HEAD and source into stdout]' \
+  '(-dump -dump_head              -dump_both -dump_extra)-dump_source[dump page source into stdout]' \
+  '(-dump -dump_head -dump_source            -dump_extra)-dump_both[dump HEAD and source into stdout]' \
+  '(-dump -dump_head -dump_source -dump_both            )-dump_extra[dump HEAD, source, and extra information into stdout]' \
+  '-post[use POST method with file content]:POST data file:_files' \
+  '-header[insert string as a header]:header:' \
+  '+-[goto specified line]:line number:_guard "[0-9]#" "line number"' \
   '-num[show line number]' \
-  '-no-proxy' \
-  '-no-mouse' \
-  '(-no-cookie)-cookie' \
-  '(-cookie)-no-cookie' \
-  '-no-graph' \
+  "-no-proxy[don't use proxy]" \
+  '(-6)-4[IPv4 only (-o dns_order=4)]' \
+  '(-4)-6[IPv6 only (-o dns_order=6)]' \
+  "-no-mouse[don't use mouse]" \
+  '(-no-cookie)-cookie[use cookie]' \
+  "(-cookie)-no-cookie[don't use cookie]" \
+  '-pauth[proxy authentication]:user\:pass:->pauth' \
+  '(-no-graph)-graph[use graphic character]' \
+  "(-graph)-no-graph[don't use graphic character]" \
   '-S[squeeze multiple blank lines]' \
   '-W[toggle wrap search mode]' \
-  '-X[do not use termcap init/deinit]' \
-  '-o[option]:option-value' \
-  '-config:config file:_files' \
+  "-X[don't use termcap init/deinit]" \
+  '-title=[set buffer name to terminal title string]:terminal:_terminals' \
+  '*-o[assign value to config option]:option=value:->option' \
+  '(- *)-show-option[print all config options]' \
+  '-config[specify config file]:configuration file:_files' \
+  '(- *)-help[print usage information]' \
+  '(- *)-version[print version information]' \
   '-debug' \
-  ':URL:->html' \
-  '+:goto line' && ret=0
-
-if [[ -n $state ]]; then
-  local w3mhistory
+  '(-B -v)*:URL:->html' && ret=0
 
-  _tags files w3mhistory urls
-  while _tags; do
-    _requested files expl 'file' _files -g "*.x#html(-.)" && ret=0
-    _requested urls expl 'URL' _urls && ret=0
-    if [[ -s ~/.w3m/history ]] && _requested w3mhistory; then
+case "$state" in
+  charset)
+    local -a charsets
+    charsets=(
+      US-ASCII ISO-8859-1 ISO-8859-2 ISO-8859-3 ISO-8859-4 ISO-8859-5
+      ISO-8859-6 ISO-8859-7 ISO-8859-8 ISO-8859-9 ISO-8859-10 ISO-8859-11
+      ISO-8859-13 ISO-8859-14 ISO-8859-15 ISO-8859-16 EUC-JP Shift_JIS
+      Shift_JISX0213 ISO-2022-JP ISO-2022-JP-2 ISO-2022-JP-3 EUC-CN GBK GB18030
+      HZ-GB-2312 ISO-2022-CN EUC-TW Big5 HKSCS EUC-KR UHC Johab ISO-2022-KR
+      TIS-620 TCVN-5712 VISCII VPS KOI8-R KOI8-U NeXTSTEP CP437 CP737 CP775
+      CP850 CP852 CP855 CP856 CP857 CP860 CP861 CP862 CP863 CP864 CP865 CP866
+      CP869 CP874 CP1006 CP1250 CP1251 CP1252 CP1253 CP1254 CP1255 CP1256
+      CP1257 CP1258 UTF-8 UTF-7
+    )
+    _wanted charsets expl 'character set' compadd -a charsets && ret=0
+  ;;
+  html)
+    local -a bookmarks w3mhistory
+    if [[ -s ~/.w3m/bookmark.html ]]; then
+      bookmarks=( ${${(M)${(f)"$(<~/.w3m/bookmark.html)"}:#<li>*}/(#b)<li><a href=\"(*)\">*/$match[1]} )
+    fi
+    if [[ -s ~/.w3m/history ]]; then
       w3mhistory=( ${(f)"$(<~/.w3m/history)"} )
-      _all_labels w3mhistory expl 'URL from history' compadd -a w3mhistory
     fi
-    (( ret )) || break
-  done
-fi
+    _alternative \
+      'files:file:_files -g "*.x#html(-.)"' \
+      'urls:URL:_urls' \
+      'bookmarks:bookmarks:compadd -a bookmarks' \
+      'history:history:compadd -a w3mhistory' && ret=0
+  ;;
+  option)
+    local -a options
+    options=( ${${(M)${(f)"$(_call_program options $words[1] -show-option 2>/dev/null)"}:#    -o *}/(#b)    -o (*)=[^ ]#[[:blank:]]##(*)/$match[1]:${match[2]:l}} )
+    if compset -P '*='; then
+      _message -e values 'value'
+    else
+      _describe -t options 'option' options -S '=' && ret=0
+    fi
+  ;;
+  pauth)
+    if compset -P '*:'; then
+      _message -e passwords 'password'
+    else
+      _users -S ':' && ret=0
+    fi
+  ;;
+esac
 
 return ret