zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: PATCH: more _long_options
Date: Mon, 08 Mar 1999 14:31:14 +0100	[thread overview]
Message-ID: <9903081331.AA25790@ibmth.df.unipi.it> (raw)

A few fixes I needed to get _long_options to work with _tar.

--- /temp/pws/zsh-3.1.5/Completion/User/_long_options.bak	Mon Mar  8 14:29:04 1999
+++ /temp/pws/zsh-3.1.5/Completion/User/_long_options	Mon Mar  8 14:29:08 1999
@@ -42,14 +42,16 @@
 
 group=()
 expl=()
-while getopts "J:V:X:t" opt; do
-  case "$opt" in
-  [JV]) group=("-$opt" "$OPTARG");;
-  X)    expl=(-X "$OPTARG");;
-  t)    test=yes;;
-  esac
-done
-shift OPTIND-1
+if [[ $1 = -*~--* ]]; then
+  while getopts "J:V:X:t" opt; do
+    case "$opt" in
+      [JV]) group=("-$opt" "$OPTARG");;
+      X)    expl=(-X "$OPTARG");;
+      t)    test=yes;;
+    esac
+  done
+  shift OPTIND-1
+fi
 
 # Test if we are completing after `--' if we were asked to do so.
 
@@ -92,7 +94,7 @@
   # use the positional parameters we were given and a few standard
   # ones. Then we loop through this table.
 
-  set "$@" '*=FILE*' '_files' '*=(DIR|PATH)*' '_files -/' '*' ''
+  set -- "$@" '*=FILE*' '_files' '*=(DIR|PATH)*' '_files -/' '*' ''
 
   while [[ $# -gt 1 ]]; do
 
@@ -107,8 +109,8 @@
     # list we have built. If no option matches the pattern, we
     # continue with the next.
 
-    tmp=("${(@M)opts:#$~pattern}")
-    opts=("${(@)opts:#$~pattern}")
+    tmp=("${(@M)opts:##$~pattern}")
+    opts=("${(@)opts:##$~pattern}")
 
     (( $#tmp )) || continue
 

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


                 reply	other threads:[~1999-03-08 13:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9903081331.AA25790@ibmth.df.unipi.it \
    --to=pws@ibmth.df.unipi.it \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).