zsh-workers
 help / color / mirror / code / Atom feed
* Re: PATCH: zsh-3.1.5-pws-10: _configure completion
@ 1999-03-05 11:13 Sven Wischnowsky
  1999-03-05 11:24 ` Andrej Borsenkow
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 1999-03-05 11:13 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> 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've been thinking about this yesterday evening. Shouldn't we try to
write a helper function `_gnu_options' or something like that?

This function would use `--help' to get the list, automatically detect
`FILE' and `DIR' to use `_files' or `_files -/' and things like
that. It could also use `_comp_parts' to complete `--foo=y<TAB>' to
`--foobar=yes' and things like that (we may want to give it options
that say which strings to complete after certain option, based on
option name or on the string that appears in the output of `--help'
after the equal sign). We probably should make it return a value that
indicates if options were completed and otherwise make it skip over
the options and report the resulting position, so that `_tar' can
easily be changed to support long options *and* in-tar-completion.

Then we could use that function in `_tar', `_configure', and `_a2ps'
and probably in a new `_gnu_command' function.

> ------=_NextPart_000_000E_01BE6705.8F107370
> Content-Type: application/octet-stream;
> 	name="_configure.patch"
> Content-Transfer-Encoding: quoted-printable
> Content-Disposition: attachment;
> 	filename="_configure.patch"

Ugh. Couldn't we try to avoid using MIME for patches, please? Using my 
self-written Emacs-based mail reader I never had problems with this
list and I really don't feel like starting up netscape or some such
horror just to get at a patch.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: zsh-3.1.5-pws-10: _configure completion
  1999-03-05 11:13 PATCH: zsh-3.1.5-pws-10: _configure completion Sven Wischnowsky
@ 1999-03-05 11:24 ` Andrej Borsenkow
  0 siblings, 0 replies; 3+ messages in thread
From: Andrej Borsenkow @ 1999-03-05 11:24 UTC (permalink / raw)
  To: Sven Wischnowsky; +Cc: zsh-workers

On Fri, 5 Mar 1999, Sven Wischnowsky wrote:

> 
> Ugh. Couldn't we try to avoid using MIME for patches, please? Using my 
> self-written Emacs-based mail reader I never had problems with this
> list and I really don't feel like starting up netscape or some such
> horror just to get at a patch.
>

And I, using Outlook (not willingly) have to make sure, that patch is not
mangled. Sigh ... Sven, really, MIME-disabled mailer now a days ...

Sent with Pine

/andrej


--- 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* PATCH: zsh-3.1.5-pws-10: _configure completion
@ 1999-03-05  9:41 Andrej Borsenkow
  0 siblings, 0 replies; 3+ messages in thread
From: Andrej Borsenkow @ 1999-03-05  9:41 UTC (permalink / raw)
  To: ZSH workers mailing list

[-- 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-03-05 11:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-05 11:13 PATCH: zsh-3.1.5-pws-10: _configure completion Sven Wischnowsky
1999-03-05 11:24 ` Andrej Borsenkow
  -- strict thread matches above, loose matches on Subject: below --
1999-03-05  9:41 Andrej Borsenkow

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).