[squeak-dev] Improving command line argument processing

K K Subbu kksubbu.ml at gmail.com
Mon Jun 8 19:26:03 UTC 2020

On 08/06/20 4:23 am, David T. Lewis wrote:
>    $ squeak squeak.image -- arg1 arg2 arg3 "do not treat arg1 as a script"

This should result in an error. Unix convention is to prefix - or -- to 
options and therefore -- is a special marker to terminate option 
processing and allow arguments beginning with -. So you can type "grep 
-- -v" to search for -v in files. In our case, squeak.image does not 
begin with - and so option processing stops automatically. Anything 
after the image file becomes the arguments for the image and not the 
platform vm. So there is no need to use -- for disambiguation.

>    $ squeak script.st arg1 arg2 arg3 ==> error image not found

On Unix, the env variable SQUEAK_IMAGE is checked if the first argument 
is not an image file. If the variable is not set, then the image file is 
assumed to be "squeak.image". So this will be a valid invocation:

      $ squeak ${SQUEAK_IMAGE:-squeak.image} script.st arg1 arg2 arg3

Regards .. Subbu

More information about the Squeak-dev mailing list