Search code examples
smalltalkgnu-smalltalk

Is it possible to run Smalltalk scripts from the command line?


I found a (possibly outdated and incorrect) blog post from 2004 which claimed that it was impossible to run Smalltalk scripts from the command line. Has anything changed since then, and is it possible to run Smalltalk scripts from the command line? I've done a lot of Google searching, and I've found no information about this topic at all.

Is there any way to save a Smalltalk script (such as this one) as a file, and then run the script from the command line?

Transcript show: 'This should be printed to the standard output.' printString; cr.

Solution

  • Pharo has decent command line support and a simple zeroconf script to install it:

    curl get.pharo.org | bash
    ./pharo Pharo.image --help
    ./pharo Pharo.image eval "1+2"
    

    We use these tools on a regular basis on our ci servers.

    New command line handles can be installed easily by subclassing. You will find a partial documentation here.

    Coral aims at more complex interfaces and supports complex parameter parsing. The default command line tools shipped with Pharo follow a rather simplistic approach and you have to check and process parameters manually.