help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] How to keep only files match the prefix when do command


From: Peng Yu
Subject: Re: [Help-bash] How to keep only files match the prefix when do command completion?
Date: Wed, 14 Dec 2011 14:38:42 -0600

> After these matches have been generated, any shell function or command
> specified with the @option{-F} and @option{-C} options is invoked.
> When the command or function is invoked, the @env{COMP_LINE},
> @env{COMP_POINT}, @env{COMP_KEY}, and @env{COMP_TYPE} variables are
> assigned values as described above (@pxref{Bash Variables}).
> If a shell function is being invoked, the @env{COMP_WORDS} and
> @env{COMP_CWORD} variables are also set.
> When the function or command is invoked, the first argument is the
> name of the command whose arguments are being completed, the
> second argument is the word being completed, and the third argument
> is the word preceding the word being completed on the current command line.
> No filtering of the generated completions against the word being completed
> is performed; the function or command has complete freedom in generating
> the matches.

Thanks for pointing me to this paragraph.

But my previous comment still applies.

"... this is written in some obscure place, but it also means that the
manual should be rewritten"

Do you expect a new users to understand section 8.6? These are all
abstract descriptions without concrete examples. Since you are the
author of bash, you will have no problem understanding it. But please
think as if you were a new user who has no zero knowledge of bash
completion.

My suggestion is to give some working examples and introduce the
options in 8.7 and then introduce 8.6. Or merge descriptions in 8.6
with the options described in 8.7 and adding examples to illustrate
the points. Or at least, refer back to section 8.6 in 8.7 for each
option discussed in section 8.7 (but this is a less optimal solution
as it introduce cyclic dependencies)?

In general, I observe that the authors of the manpage tend to save
words when things can be explained better with more words and examples
(like the one given by Geir). To make the manpage read, this trend
should be reversed.

"the first argument is the name of the command whose arguments are being
completed, the second argument is the word being completed, and the
third argument is
the word preceding the word being completed on the current command line."

The above is very hard to catch for user who basically gets lost in
that section. Why don't you put it in the description of -F? And
explicitly spell $1, $2 and $3 so that they become more searchable?

-- 
Regards,
Peng



reply via email to

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