separate the command language and interactive she

David Gudeman gudeman at cs.arizona.edu
Sat May 4 09:06:48 AEST 1991


In article  <1991May02.171036.23843 at sco.COM> John R. MacMillan writes:
]
]I envision something like the following:  user starts "ish -emacs fsh".
]Ish advertises a communications channel, and starts a friendly sh,
]which notices the communications channel.  User types "cdb
]pro<ESC><ESC>", and ish passes "cdb pro" down the communication
]channel (probably with some other info).  Fsh completes to "cdb
]program", gives it back to ish...

That is more-or-less what I had in mind.  Taking completion as an
example: each ish-ready program has a set of named things.  The user
wants to be able to type part of the name followed by some signal that
means "complete the previous name".  However, there might be several
classes of name things, and you only want to complete within the
correct class.  For example in a clang, you want seperate completion
for commands, filenames, and environment variables.

Part of this can be communicated by command-line description such as

  <command-line> ::= <command> <arg>* | "set" <var> = <arg>
  <arg> ::= "-"<char>* | "$"<var> | <file>
  path-complete <command> with "echo $path"
  path-complete <file> with "pwd"
  list-complete <var> with "variable-completion %s"

Each ish-ready program would have such a specification plus a set of
commands, (in this case just "variable-completion") that print out a
list of possible completions.  This eliminates the need for a
communication channel.

Type "set TE<ESC><ESC>" at the prompt.  The ish gathers characters
until the control sequence.  Then it looks at the specification for
this command and finds that it must use the "variable-completion" to
find the completions of this name.  It sends the string

  variable-completion TE

to the stdin of the clang which responds with

  TERM
  TERMCAP
  (prompt)

on its stdout.  The ish doesn't display this output since it is
internal communication.  Rather the ish parses it and completes
the name as far as possible, extending the user's command line to

  set TERM

The nice thing about this is that "variable-completion" is a normal
command that anyone can type, it doesn't require any special
communication apparatus.

The ish has pathname completion built in, so for command and filename
completion it would only ask the clang for its exec-path or current
directory and do its own completion.  Type "ico<ESC><ESC>".  The ish
sends the command "echo $path" to the clang which responds with the
path.  Then the ish completes the command according to the path.

These command-line descriptions can be fixed files that the ish
accesses.  The only other information the ish needs is what command is
executing, and it can get that from startup messages.  I'm beginning
to think again that a special communication channel is not needed.  If
you can get by without one then you should, since the writer of
ish-ready application shouldn't have to worry about that sort of
thing.  Is there any sort of communication that couldn't be handled by
this scheme?
--
					David Gudeman
gudeman at cs.arizona.edu
noao!arizona!gudeman



More information about the Comp.unix.shell mailing list