[ENH][GOODIE] CommandShell V1.6 (version 1.6 released)

David T. Lewis lewis at mail.msen.com
Sun Jan 6 15:34:01 UTC 2002


CommandShell 1.6
Previous released version: CommandShell 1.5.2
Best if used with OSProcess 2.7

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 most useful
on Unix systems with OSProcess. Windows is supported, although external
command execution is not net available. MacOS and other platforms have
not been tested.

When running on a Windows platform, CommandShell provides Unix style
command line parsing with DOS device names (C:, D:, etc) to mimic the
normal behavior of a DOS command shell. A set of builtin commands
('cd', 'pwd', 'sls' and 'edit') provide enough functionality to navigate
Windows file systems, list directory contents, and edit files.

On Windows, DOS style device names (such as 'C:') are recognized as part
of the path syntax, and separate current working directory paths are
maintained for each DOS style device. The command '$ cd D:' is interpreted
to mean 'change to the D: device and use its previous working directory
path'. When running on Unix, a single current working directory path is
maintained in the usual manner.

CommandShell provides a simple script processing capability. The
scripting methods are contained in the 'command scripting' category of
class CommandShell.

A script is a String containing a list of zero or more commands delimited
by Character cr. Each command in the list is treated as as a CommandShell
command line. The script commands may consist of a mix of Smalltalk
expressions, shell builtins, and external commands. Simple conditional
branching is supported for commands or scripts based on testing the exit
status of the command lines or scripts.

Try evaluating these expressions:
	CommandShell command: 'help'
	CommandShell open
	CommandShell new command: 'ps -aef | edit'
	CommandShell command: 'ps -aef | edit'
	CommandShell new 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.

ShellBuiltin contains the implementations for shell builtin commands.
Instances of ShellBuiltin represent various commands, and may be installed
into an instance of CommandShell with CommandShell>>installCommand:.

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.6 since CommandShell 1.5:
- Added limited support for Win32 to CommandShell, with correct file and
  path expansion.
- Added new 'sls' internal command to provide a simple directory listing.
- Add support for multiple working directories (one per device) for Windows.
- Renamed UnixCommandSyntax as ShellSyntax, and gave it responsibility
  for maintaining current working directories.
- Isolated platform specific methods in a 'platform specific' method category.
- Added scripting capability for the Squeak shell (see 'command scripting'
  category of class CommandShell).
- Fixed bug in ShellSyntax>>programNameAndArgumentsFrom:inDirectoryPath:
  in which a fully specified path was incorrectly evaluated.
- Added class ShellBuiltin, and moved all built in commands from
  CommandShell to the separate ShellBuiltin class.
- Added CommandShell class>>versionString.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: CommandShellV1-6-dtl.cs.gz
Type: application/x-gunzip
Size: 46457 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020106/6a99194f/CommandShellV1-6-dtl.cs.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CommandShell-menuV1-6-dtl.cs.gz
Type: application/x-gunzip
Size: 1095 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020106/6a99194f/CommandShell-menuV1-6-dtl.cs.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CommandShell-sUnitV1-6-dtl.cs.gz
Type: application/x-gunzip
Size: 4852 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020106/6a99194f/CommandShell-sUnitV1-6-dtl.cs.bin


More information about the Squeak-dev mailing list