zsh-workers
 help / color / mirror / code / Atom feed
From: "Andrej Borsenkow" <borsenkow.msk@sni.de>
To: "ZSH workers mailing list" <zsh-workers@sunsite.auc.dk>
Subject: PATCH: zsh-3.1.5-pws-10: _configure completion
Date: Fri, 5 Mar 1999 12:41:58 +0300	[thread overview]
Message-ID: <000d01be66ec$69c33b70$21c9ca95@mowp.siemens.ru> (raw)

[-- Attachment #1: Type: text/plain, Size: 321 bytes --]

This patch tries to be a bit smarter.

- it is using matching control, so --e-z-m completes to --enable-zsh-mem*
- it tries to guess (basing on --help output) if parameter takes an argument
and appends ``=''. If argument is indicated as optional, ``='' is
autoremoved.

I'm gonna like this new stuff, really :-)

/andrej

[-- Attachment #2: _configure.patch --]
[-- Type: application/octet-stream, Size: 1081 bytes --]

--- Completion/User/_configure	Thu Mar  4 19:27:03 1999
+++ /home/bor/.zsh.d/Completion/User/_configure	Fri Mar  5 12:27:58 1999
@@ -1,5 +1,7 @@
 #defcomp configure
 
+setopt localoptions extendedglob
+
 if [[ $PREFIX = *=* ]]; then
   # Complete filenames after e.g. --prefix=
   IPREFIX=${PREFIX%%=*}=
@@ -7,6 +9,27 @@
   compgen -f
 else
   # Generate a list of options from configure --help
-  compgen -s '$($words[1] --help |
-  sed -n -e '\''s/^ *\(--[-a-z0-9]*\)[    =,].*$/\1/p'\'')'
+  local -a pars
+  local i
+  pars=($($words[1] --help | awk '$1 ~ /--[a-z]*.*/ {print $1}'))
+  for i in $pars
+  do
+    case $i in
+      (--(((en|dis)able-FEATURE)|(with(out|)-PACKAGE))*)
+        : Skip standard help output
+      ;;
+      --enable)
+        : Skip standard help output
+      ;;
+      --*\[=* )
+        compadd -M 'r:|-=* r:|=*' -q -S = -- ${i%%\[=*}
+      ;;
+      --*=* )
+        compadd -M 'r:|-=* r:|=*' -S = -- ${i%%=*}
+      ;;
+      * )
+        compadd -M 'r:|-=* r:|=*' -- $i
+      ;;
+    esac
+  done
 fi

             reply	other threads:[~1999-03-05  9:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-05  9:41 Andrej Borsenkow [this message]
1999-03-05 11:13 Sven Wischnowsky
1999-03-05 11:24 ` Andrej Borsenkow

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='000d01be66ec$69c33b70$21c9ca95@mowp.siemens.ru' \
    --to=borsenkow.msk@sni.de \
    --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).