[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: TAB completion after "nice"
From: |
Peter D. |
Subject: |
Re: TAB completion after "nice" |
Date: |
Thu, 25 Mar 2004 17:37:00 +1100 |
User-agent: |
KMail/1.5.4 |
On Tuesday 23 March 2004 10:29, Paul wrote:
> "Peter D." <psd@alphalink.com.au> wrote:
> > When the first word on a line is "nice" the second word should
> > be expanded as a command from PATH rather than a file name
> > argument.
>
> See the "Programmable Completion" section in the man page.
>
>
> paul
Paul,
*Nice* try - but you don't win a cigar this time. ;-)
I have had a look at the bash man pages. Large, aren't they?
->complete -A command nice
Almost does what I want. TAB completion of everything after "nice"
expands to a command.
->nice tri[TAB]
expand nicely ;-) to "nice tripwire", but tripwire take file names as
parameters.
->nice tripwire -m c -I -p /etc/tripwire/t[TAB]
now expands (wrongly) to "twinstall.sh" (an executable)
rather than "tw2.pol", like it used to. Both are in "/etc/tripwire/".
Is it necessary to have a "complete" line for "tripwire" as well?
(Tried it. It does not override the "complete -A command nice".)
If so, then a "complete" line would be needed for any command
that might be niced. Basically, that would be *all* of them.
Now to make the problem harder, let's try "man".
->complete -A command man
Almost does what I want. TAB completion of everything after "man"
expands to a command.
->man apro[TAB] utm[TAB]
gives
->man apropos utmpdump
I want, "man apropos utmp". With an extra TAB offering a choice
of "utmp" and "utmpdump". Some files have man pages as well
as commands having man pages. It would be necessary for
bash to look at MANPATH or somehow communicate with man
to sort this out.
This is shaping up to be a large and difficult problem requiring
a database of what sort of parameters each command can
take with a intelligent decision about which command's
parameters are being expanded. Perhaps a text file in /etc
which administrators and installation programs can write to?
BTW I am not subscribed to the mailing list.
Thank you.
--
Sig goes here ...
Peter D.