bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Specify completion without name


From: Clark J. Wang
Subject: Re: Specify completion without name
Date: Fri, 6 Jan 2012 11:09:23 +0800

On Fri, Jan 6, 2012 at 00:33, Peng Yu <pengyu.ut@gmail.com> wrote:

> > I would envision that such a completion function would assemble its list
> > of possible completions by using your read-from-a-file mechanism and
> > augment the list using compgen -a/compgen -b/compgen -A function.  It
> > would probably also want to handle glob patterns and expand them to
> > potentially multiple completions, but that gets tricky.
>
> I did not know that it is so simple to get the alias (compgen -a),
> buildins (compgen -b) and functions (compgen -A function) as you
> mentioned. Once I know these, I agree with you that bash need not
> handle these internally, rather user can call these three functions
> directly. But beware to clearly document these by giving working
> EXAMPLE code which include these three commands (not just text
> explanation without working code, by "working code" I mean code
> snippet is discouraged, a complete completion function should be
> provided).
>

The bash man page already has ~70 pages manual. I don't like it to grow to
~700 pages (like the ABS Guide) with all the working examples you expected.
:)

>
> BTW, as I mentioned several times the bash man favors document
> maintainer rather readers. For example, the following help doesn't
> help me much when I want to learn how to use compgen.
>
> ~$ help compgen
> compgen: compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat]
> [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C
> command] [word]
>    Display the possible completions depending on the options.  Intended
>    to be used from within a shell function generating possible completions.
>    If the optional WORD argument is supplied, matches against WORD are
>    generated.
>
> The manpage also use a reference rather than list all the options
> directly. Readers have to jump to complete to understand how to use
> compgen. This is also inconvenient to users.
>
>              Generate possible completion matches for word according  to
>  the
>              options,  which  may  be  any  option  accepted  by the
> complete
>              builtin
>
>
> If you consider it repetitive to discuss the same option twice in both
> compgen and complete, at least, you can expand "help compgen" to
> describe all the options (merge the current description of compgen and
> complete in man). Other help messages are so concise that they are not
> very helpful for learning how to use them. I'd suggest change all of
> them as well.
>
> --
> Regards,
> Peng
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]