zsh-users
 help / color / mirror / code / Atom feed
* Globbing on what the completion function would suggest?
@ 2008-10-19 20:12 Richard Hartmann
  2008-10-19 20:19 ` Mikael Magnusson
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Hartmann @ 2008-10-19 20:12 UTC (permalink / raw)
  To: zsh-users

Hi all,

I want to do the following (pseudocode):

  apt-cache show expand_completion(*foo*)

where *foo* globbing on what the completion would suggest,
at this point. Unfortunately, I could not figure it out, by
myself.


Any pointers?
Richard


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

* Re: Globbing on what the completion function would suggest?
  2008-10-19 20:12 Globbing on what the completion function would suggest? Richard Hartmann
@ 2008-10-19 20:19 ` Mikael Magnusson
  2008-10-19 21:26   ` Richard Hartmann
  0 siblings, 1 reply; 5+ messages in thread
From: Mikael Magnusson @ 2008-10-19 20:19 UTC (permalink / raw)
  To: Richard Hartmann; +Cc: zsh-users

2008/10/19 Richard Hartmann <richih.mailinglist@gmail.com>:
> Hi all,
>
> I want to do the following (pseudocode):
>
>  apt-cache show expand_completion(*foo*)
>
> where *foo* globbing on what the completion would suggest,
> at this point. Unfortunately, I could not figure it out, by
> myself.

I don't know if I've done anything special, but for example if I do
ls --[ab]<tab>, i get
---- option
--all         -- do not ignore entries starting with .
--almost-all  -- do not list implied . and ..
--author      -- with -l, print the author of each file
--block-size  -- use SIZE-byte blocks

I can't test the show completion since I don't use debian, but
apt-cache [md]*<tab> behaves the same way.

-- 
Mikael Magnusson


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

* Re: Globbing on what the completion function would suggest?
  2008-10-19 20:19 ` Mikael Magnusson
@ 2008-10-19 21:26   ` Richard Hartmann
  2008-10-20 15:22     ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Hartmann @ 2008-10-19 21:26 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: zsh-users

On Sun, Oct 19, 2008 at 22:19, Mikael Magnusson <mikachu@gmail.com> wrote:

> I don't know if I've done anything special, but for example if I do
> ls --[ab]<tab>, i get

> I can't test the show completion since I don't use debian, but
> apt-cache [md]*<tab> behaves the same way.

I don't know what options you have set, but on 4.3.6 on Debian
unstable, this does not complete anything, for me.


I should have been clearer in my initial email: I don't want to do
this interactively, I want to do this on the CLI or in a script.


Richard


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

* Re: Globbing on what the completion function would suggest?
  2008-10-19 21:26   ` Richard Hartmann
@ 2008-10-20 15:22     ` Bart Schaefer
  2008-10-20 15:27       ` Richard Hartmann
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2008-10-20 15:22 UTC (permalink / raw)
  To: zsh-users

On Oct 19, 11:26pm, Richard Hartmann wrote:
}
} I should have been clearer in my initial email: I don't want to do
} this interactively, I want to do this on the CLI or in a script.

In order to do this, you'd have to write a wrapper function that sets
up a fake completion context (the compstate hash, the words array,
the values of all the ZLE special variables, and so on), and that
also defines compset and compadd functions, etc.  Then you'd have to
examine whatever arguments were passed to your dummy compadd after
you invoke the completer function.

Or equivalently you need to re-implement all the completion modules in
non-interactive versions that don't need the ZLE line context.

A third possibility is to do what comptest.zsh in the test suite does:
Create a psuedo-terminal with zpty running an interactive shell, send
it a partial command line and a list-choices keystroke to produce a
completion listing, and then read back the results.


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

* Re: Globbing on what the completion function would suggest?
  2008-10-20 15:22     ` Bart Schaefer
@ 2008-10-20 15:27       ` Richard Hartmann
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Hartmann @ 2008-10-20 15:27 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

On Mon, Oct 20, 2008 at 17:22, Bart Schaefer <schaefer@brasslantern.com> wrote:

> [three possibilies]

I fear the work involved is far greater than the gain, so I will pass.


Thanks for your detailed answer, though!
Richard


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

end of thread, other threads:[~2008-10-20 22:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-19 20:12 Globbing on what the completion function would suggest? Richard Hartmann
2008-10-19 20:19 ` Mikael Magnusson
2008-10-19 21:26   ` Richard Hartmann
2008-10-20 15:22     ` Bart Schaefer
2008-10-20 15:27       ` Richard Hartmann

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