zsh-users
 help / color / mirror / code / Atom feed
* Re: How to do completion with read?
@ 1999-11-04  8:21 Sven Wischnowsky
  0 siblings, 0 replies; 5+ messages in thread
From: Sven Wischnowsky @ 1999-11-04  8:21 UTC (permalink / raw)
  To: zsh-users


Paul Lew wrote:

> >>>>> "Bart" == Bart Schaefer <schaefer@candle.brasslantern.com> writes:
> 
>     Bart> Here's my "zleread" function again.  Insert some commands to
>     Bart> fiddle with the completion context just before the call to
>     Bart> "vared" and you can get it to complete any way you like.
> 
> Thanks for the script.  I'm guessing what you mean by fiddle with the
> completion context is to create a temporary directory and create dummy
> files for completion purpose?  So there is no mechanism to pass
> zcompctl arguments to vared?  Seems vared only complete filename?

Actually, `vared' completes its line in the same way a command line is 
completed. I.e. it uses all the `compctl' definitions you have
(including the one for `-C' for the first word on the line).

What Bart probably meant was that with the new completion system in
version 3.1.6 you can set the parameter `compcontext' in such a
function to specify how words in the line read should be completed.

Since you seem to use an older version: if your version already
supports the `-T' flag to `compctl' (which is quite old), you can use
that to say what should be completed in such a function, e.g.:

  compctl -Tk '(foo bar baz)'
  vared line
  compctl -T ...  # reset to standard value

Resetting it should be possible by first storing the output of
`compctl -LT' and later `eval'ing it (be careful if that contains
quotes).

If you are using a 3.1.6, you'll have to add a `-tn' to the first
`compctl -T'. But then... if you are using 3.1.6, you probably should
think about moving to the function based completion system anyway.

Bye
 Sven


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


^ permalink raw reply	[flat|nested] 5+ messages in thread
* How to do completion with read?
@ 1999-11-03 16:52 Paul Lew
  1999-11-03 17:10 ` Francis GALIEGUE
  1999-11-03 17:18 ` Bart Schaefer
  0 siblings, 2 replies; 5+ messages in thread
From: Paul Lew @ 1999-11-03 16:52 UTC (permalink / raw)
  To: zsh-users

Is there a way to use completion mechanism when prompt user for input
in zsh function/scripts?  For example,

echo -n "Enter choice: "
read -C '-k "(orange apple banana)"' choice

The example about use imaginary option '-C' which tell zsh to pass the
next argument as compctl argument.

Any help will be appreciated...


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

end of thread, other threads:[~1999-11-04  9:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-04  8:21 How to do completion with read? Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
1999-11-03 16:52 Paul Lew
1999-11-03 17:10 ` Francis GALIEGUE
1999-11-03 17:18 ` Bart Schaefer
1999-11-03 18:20   ` Paul Lew

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