Hi Steve,

> On 25 Dec 2018, at 19:45, Steve Quezadas <st...@thestever.net> wrote:
> 
> What happened to the pharo commandline "eval" function?
> 
> Does anyone know what happened to the pharo "eval" function on the 
> comnandline? It seems to have disappeared in the newer versions. The Coral 
> thing also seems to be abandoned as the readme is no longer there:
> http://smalltalkhub.com/#!/~PharoExtras/Coral
> 
> Is there any way to send messages to pharo from commandline? Sometimes I 
> write an object in pharo and it can be useful to use if I am runing a linux 
> shell. Sometimes I have a bash script or something that needs an answer from 
> pharo.
> 
> - Steve

What do you mean, AFAICT it is still there and works as before. Here is a 
terminal transcript on macOS:

prometheus:2018-12-20 sven$ ./pharo Pharo.image printVersion
[version] 'Pharo7.0.0' 
'Pharo-7.0.0+rc1.build.66.sha.0ff3a6c1c0f1d9b2876c50e19b790dd7bb926dd9 (64 Bit)'

prometheus:2018-12-20 sven$ ./pharo Pharo.image --list
Currently installed Command Line Handlers:
    loadHermes            Loads the hermes files passed as parameter
    printVersion          Print image version
    save                  Rename the image and changes file
    initializePackages    Initialize packages and protocols from a given lists
    st                    Loads and executes .st source files
    config                Install and inspect Metacello Configurations from the 
command line
    metacello             Install and inspect Metacello 
Baselines/Configurations from the command line
    test                  A command line test runner
    Fuel                  Loads fuel files
    clean                 Run image cleanup
    get                   Install catalog projects from the command line 
(consult catalog at http://catalog.pharo.org)
    perform               Perform given message on a specified class or global
    eval                  Directly evaluates passed in one line scripts

prometheus:2018-12-20 sven$ ./pharo Pharo.image eval --help
Usage: eval [--help] [--save] [ --no-quit ] <smalltalk expression>
        --help                   list this help message
        --save                   save the image after evaluation of the 
expression
        --no-quit                if specified, the image continues runing after
                                 evaluating the <smalltalk expression>
        <smallltalk expression>  a valid Smalltalk expression which is 
evaluated and 
                                 the result is printed on stdout

Documentation:
A CommandLineHandler that reads a string from the command line, outputs the 
evaluated result and quits the image. 

This handler either evaluates the arguments passed to the image:
        pharo Pharo.image eval  1 + 2
        
or it can read directly from stdin:

        echo "1+2" | $PHARO_VM my.image eval

Important: don't manually save the image at the end of the expression by 
calling something like 'Smalltalk snapshot: true andSave: true'! Instead, use 
the safer --save option.

prometheus:2018-12-20 sven$ ./pharo Pharo.image eval '42 factorial'
1405006117752879898543142606244511569936384000000000

HTH,

Sven


Reply via email to