[TUHS] Systematic approach to command-line interfaces

Chet Ramey chet.ramey at case.edu
Mon Aug 2 09:21:16 AEST 2021

On 8/1/21 5:53 PM, Dan Cross wrote:

> Thanks for the useful background information on existing solutions.
> If I understood the proposal correctly, it was that the program in question 
> would, itself, be the generator as described above. Perhaps it was coupled 
> with a standard structured format for consumption by the shell, which seems 
> like it would be useful for this sort of expansion.

Yes, it would make writing generators easier. The rest of the process
would change very little: determining the word to complete, determining
the command name, breaking the edit line into words for the generator,
invoking the generator through the appropriate mechanism, parsing the
results, and processing the matches. From the shell's perspective, it's a
minor change.

> Of course, the process model in TOPS-20 was very different than in Unix, 
> and in that system, as soon as you typed the _name_ of a command it's image 
> was "run up" in your process. So the interactive help system was provided 
> by a running instance of the program itself. What I gathered from the 
> proposed model was that it involvedĀ multiple invocations of the program, 
> but with a special option that would trigger behavior informally described 
> as, "here's the context I've built so far; let me know what options are 
> available here." I don't know that it's terribly "Unixy", but I can see how 
> it would be useful for interactive use.

Yes. None of this is very "Unixy", but people have gotten used to being
able to use capabilities like completion.

When you're running interactively, running additional processes when
you're performing word completion isn't particularly expensive. Again
from the shell's perspective, invoking one generator that executes a
program with `--shell-help' isn't that much different or more expensive --
and simpler in some ways because you don't have to save any incremental
parsing state -- than executing a shell function that runs several
processes, mostly command substitutions.

``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet at case.edu    http://tiswww.cwru.edu/~chet/

More information about the TUHS mailing list