zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: Nested completion of arguments
Date: Wed, 1 Sep 1999 13:38:40 +0200 (MET DST)	[thread overview]
Message-ID: <199909011138.NAA00197@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Andrej Borsenkow"'s message of Wed, 1 Sep 1999 15:13:56 +0400


Andrej Borsenkow wrote:

> Sorry, I could not follow recent changes closely, so may be this question is
> trivial.
> 
> I'd like to have completion for mount and share commands. On our system (SVR4
> based) the general syntax of mount is
> 
> mount [-F FSType] [-Vr] [-o specific_options] special mount_point
> 
> where specific_options are in the form
> 
> option[=value],...
> 
> The same is for share, 'course.
> 
> The question is, is it currently possible to complete this `specific_options'
> part (with autoremoved `,' and all this completion sugar). Note, that values of
> options may itself be completed as list; the trivial example is
> 
> share -o root=host1:host2
> 
> Also, the possible values for specific options depends on FSType.
> 
> I don't ask for a complete function :-) but just for a hint what can be used.
> 
> Note, that this form is officially blessed by UNIX specs as getsubopt()
> function. So, it may be nice to have a general way to parse such option string.
> (Not that I can name other commands that use it offhead).

The `actions' that can be given to `_arguments' are based on the ones
that were possible with `_long_options' -- plus a few new nice things.
So, yes, you could use `_arguments' in `_mount' and then make it
either call another function to complete the sub-options (which, of
course, is quite trivial to write, as you know) or -- in the way
recently suggested make it set some parameter and test that in the
calling function to complete the options there. We don't have support
to describe such sub-options. And I think, this should probably be
done with a separate function, at least don't see any advantage in
adding this to `_arguments'.

We don't have support to get at options found on the command line,
yet, only at the normal arguments. But this could be added. One
question is, how we store this information. It would be nice if we
could use an association mapping options to their arguments, but that
won't work because we would need to store arrays in an association
then. Hm, we could use an association mapping options to names of
(temporary) arrays holding the arguments. But maybe someone has a
better idea?
Also, currently we only parse the command line up to the word the
cursor is on. With that any options after that wouldn't appear, so
this should probably be changed (and make things a bit slower).

Btw, if we start using `_arguments' with the parameter-setting thing
we would have to set `compstate[restore]=""' in it to make sure the
calling function gets the changed special parameters when completing
e.g. directly after an option. We could make this optional. We could
make this optional on a per-action basis. This may then be a reason to 
add a action syntax for such `states'.
We should also make the `line' array be available in the calling
function, then.

And while I'm at it, I forgot to answer one of Tanakas comments: I
also made the suggestion about the state machines so that we could
cram everything for a suite of commands (or monster-commands such as
cvs) into one function while still making them readable (with a 
`case ... esac'). After all, people want us to reduce the number of
functions (which I can understand).

Bye
 Sven


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


             reply	other threads:[~1999-09-01 11:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-01 11:38 Sven Wischnowsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-09-01 11:13 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=199909011138.NAA00197@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.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).