Thread View: gnu.bash.bug
2 messages
2 total messages
Started by Ray Nickson
Wed, 23 Aug 1989 21:59
completion on command arguments and switches
Author: Ray Nickson
Date: Wed, 23 Aug 1989 21:59
Date: Wed, 23 Aug 1989 21:59
26 lines
1639 bytes
1639 bytes
Some time ago, during a discussion on what the switches to the `type' command should be, Brian wrote something like: I don't know why you're complaining that these switches are too long. You should be complaining that you cannot do completion on them. (sorry, I've junked the message containing the exact quote; from memory, this was the general idea though). I awaited some reaction to this, before commenting myself, but none forthcame. Was it just a throwaway line or do you really have plans in this direction? Something like VMS's (horror!) command description language so the shell can know about what sort of arguments each command expects and can do completion (and globbing!) appropriately? Such a thought has brought groans of derision from nearly every un*x hacker I've spoken to, yet I've never heard a good argument against it. Is there anything in the back (or the front!) of your mind(s)(*) in this direction? (*) BTW, is bash entirely bfox's baby, or do others (rms?) have continuing major input? -rgn -- Ray Nickson, Dept. Comp. Sci., Victoria University of Wellington, New Zealand. nickson@comp.vuw.ac.nz ...!uunet!vuwcomp!nickson + 64 4 721000x8593
Re: completion on command arguments and switches
Author: Michael Meissner
Date: Thu, 31 Aug 1989 17:46
Date: Thu, 31 Aug 1989 17:46
61 lines
3693 bytes
3693 bytes
In article <8908232203.AA15814@comp.vuw.ac.nz> nickson@comp.vuw.ac.nz (Ray Nickson) writes:
| Some time ago, during a discussion on what the switches to the `type'
| command should be, Brian wrote something like:
| I don't know why you're complaining that these switches are too long.
| You should be complaining that you cannot do completion on them.
| (sorry, I've junked the message containing the exact quote; from
| memory, this was the general idea though).
|
| I awaited some reaction to this, before commenting myself, but none
| forthcame. Was it just a throwaway line or do you really have plans
| in this direction? Something like VMS's (horror!) command description
| language so the shell can know about what sort of arguments each
| command expects and can do completion (and globbing!) appropriately?
| Such a thought has brought groans of derision from nearly every un*x
| hacker I've spoken to, yet I've never heard a good argument against
| it.
|
| Is there anything in the back (or the front!) of your mind(s)(*) in this
| direction?
I've thought about completion some, and have come to the conclusion
that it would very useful to have command specific completion. For
example, I would like completion of a directory in the "cd" command,
to scan all directories in the current CDPATH. When I'm invoking gcc,
I would like it to know about the switches, etc. Now, I don't mean
making bash know about every single command and such. Rather, I think
it should be in the UNIX tradition, of foisting off the stuff to
pipelines.
I've come up with the following different ideas, which are all
variations on the same theme of allowing the user to have an arbitrary
process being able to specify completions:
1) Given a directory (pointed to by an environment variable)
containing different executables, if a completion is
requested, search the directory for a match of a file against
the current command being formed (stripping off the directory
prefixes), invoke the program in the directory with the item
needing a completion, and read it's stdout for a list of
completions. If the program doesn't exist, the normal
completion is done.
2) If desired (ie, through setting an environment variable), fork
off a user defined program when bash starts up or when the
environment variable is changed. Stdin of the process is
connected via a pipe to bash, as is stdout. Bash would then
send the current input line needing a completion to the child
process, which would either send back an indication to use the
default completions (say an empty line), or a list of possible
completions (say one completion per line, followed by an empty
line).
3) Same as #1, except invoke the program each time a completion
is needed.
--
--
Michael Meissner, Data General.
Uucp: ...!mcnc!rti!xyzzy!meissner If compiles were much
Internet: meissner@dg-rtp.DG.COM faster, when would we
Old Internet: meissner%dg-rtp.DG.COM@relay.cs.net have time for netnews?
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads