* PATCH: more _long_options
@ 1999-03-08 13:31 Peter Stephenson
0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 1999-03-08 13:31 UTC (permalink / raw)
To: Zsh hackers list
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-03-08 13:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-08 13:31 PATCH: more _long_options Peter Stephenson
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).