[ENH][GOODIE] CommandShell V1.5 (version 1.5 released)

David T. Lewis lewis at mail.msen.com
Sun Dec 9 02:33:50 UTC 2001


CommandShell 1.5
Author: David T. Lewis
Previous released version: CommandShell 1.4
Best if used with OSProcess 2.6

The version adds better Smalltalk command processing, some bug fixes,
and new documentation.

CommandShell is a Smalltalk simulation of a Unix command shell, with a
simple dumb terminal window in Morphic and MVC. It is useful for running
programs without leaving Squeak, and for piping command output directly
into Squeak.

CommandShell can be loaded and run on any platform, but is only
really useful on Unix systems with OSProcess (the shell, command line
parsing, internal commands, doIts, and so forth will work, but external
commands can only be run on a Unix system with OSProcess).

Try evaluating these expressions:
	CommandShell command: 'help'
	CommandShell open
	CommandShell command: 'ps -aef | edit'
	CommandShell command: 'edit /etc/hosts'
	CommandShell command: 'edit /etc/hosts; exit'
	CommandShell command: 'help | edit'
	CommandShell command: 'ps -aef | edit'
	CommandShell command: 'Time dateAndTimeNow!! | edit; exit'
	CommandShell command: 'Class allSubInstances!! | edit; exit'
	CommandShell command: 'type type | inspect; exit'

Class CommandShell is a command shell, similar to /bin/sh, with a command
line user interface. It collaborates with process proxies to provide command
execution, and provides a limited set of built in commands similar to those in
a Unix shell. Built in commands are implemented in Smalltalk. Simple
Smalltalk expressions, followed by $!!, are evaluated as doIt commands.
All other commands are passed to process proxies to be executed externally.

CommandShell can open a terminal window in either Morphic or MVC.

UnixCommandSyntax implements command line parsing and file name globbing. This allows direct execution of external commands without use of
an external command shell.

PipeableEvaluator evaluates Smalltalk expressions and provides a framework
for pipelines of expressions combining Smalltalk expressions with external
Unix commands. It behaves similarly to a ConnectedUnixProcess. Both the
shell builtin commands and doIt expression commands are implemented with PipeableEvaluator.

CrLfFileEditor is a simple editor which can be used within command pipelines.
The 'edit' shell builtin creates an instance of CrLfFileEditor.

Changes in CommandShell 1.5 since CommandShell 1.4:
- Added some more documentation (CommandShell class>>overview).
- Added direct Smalltalk evaluation to command line processing. Each
  command line is first evaluated as a Smalltalk, with no interpretation
  of shell characters such as $| prior to the evaluation. If this evaluation
  fails (either in the Compiler or at runtime), the command line is assumed
  to be a command pipeline and is subject to shell syntax interpretation
  (including doIt expressions, which may themselves be simple Smalltalk
  expressions). This turns out to work surprisingly well, with very little
  conflict with expected Unix style command interpretation. 
- Fixed various problems with error pipeline handling, and added SUnit
  tests to verify.
- Fixed a problem which allowed some pipeline data to be lost when
  piping very large strings to an editor or an inspector.
- Consolidated some code into #copyAllFrom:to: and improved performance
  for internal pipelines using this method.
- Fixed a bug in output and error redirection from the last process in
  a pipeline, where the last process is an internal command. For
  example, '$ who | copyToOutput > b' generated an error. Added SUnit
  tests to catch this condition.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: CommandShellV1-5.cs.gz
Type: application/x-gunzip
Size: 40140 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20011208/ee06bf11/CommandShellV1-5.cs.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CommandShell-menu-V1-5.cs.gz
Type: application/x-gunzip
Size: 1089 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20011208/ee06bf11/CommandShell-menu-V1-5.cs.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CommandShell-sUnit-V1-5.cs.gz
Type: application/x-gunzip
Size: 4852 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20011208/ee06bf11/CommandShell-sUnit-V1-5.cs.bin


More information about the Squeak-dev mailing list