[Pharo-users] CommandLineHandler surprises

Sven Van Caekenberghe sven at stfx.eu
Wed Jan 27 14:21:39 EST 2016


Of course it opens an image, else nothing would work ;-)
I suspect you mean it opens a UI ? 
That should not happen, it depends on what your ./pharo actually is or does.
In any case, rest assured, using it on the command line works perfectly.

On the first Linux server that I log in to:

$ cat ~/pharo/bin/pharo
#!/usr/bin/env bash
# some magic to find out the real location of this script dealing with symlinks
DIR=`readlink "$0"` || DIR="$0";
DIR=`dirname "$DIR"`;
cd "$DIR"
cd - > /dev/null 
# disable parameter expansion to forward all arguments unprocessed to the VM
set -f
# run the VM and pass along all arguments as is
"$DIR"/"pharo-vm/pharo" --nodisplay  "$@"

$ ~/pharo/bin/pharo ~/pharo/build/Pharo.image --list
Currently installed Command Line Handlers:
    Fuel            Loads fuel files
    config          Install and inspect Metacello Configurations from the command line
    save            Rename the image and changes file
    update          Load updates
    printVersion    Print image version
    st              Loads and executes .st source files
    test            A command line test runner
    clean           Run image cleanup
    eval            Directly evaluates passed in one line scripts

$ ~/pharo/bin/pharo ~/pharo/build/Pharo.image eval '123 factorial'



> On 27 Jan 2016, at 19:59, Jimmie Houchin <jlhouchin at gmail.com> wrote:
> Hello,
> I am reading the Deep Into Pharo book. I have been playing with the CommandLineHandler. I have been surprised by some of its behavior. Though I have used Pharo a long time. I have not played with it from the command line. I am a very long time Linux user and am very comfortable on the command line.
> When according to the book I execute:
> ./pharo Pharo.image --list
> It will provide me with a list of the available handlers.
> I did not expect it to open up an image for me. That is not what I expected or wanted. I did not intend to use an image at this time. I am on the command line and expecting to see results there. Not for a new window to pop up.
> As of yet I have always opened up Pharo on the command line. I have yet to use PharoLauncher, but do intend to do so soon. So I am comfortable with  Pharo opening up a new window and image from the command line.
> However it is very unintuitive and seemingly unnecessary to open up an image for these command line handlers. I naively think they should simply return the results. Now if that requires opening a headless image for a moment and close, then fine.
> --list
> --help
> --version
> --copyright
> eval
> printVersion
> Some other handlers I do not know if opening an image is the correct default. I have not spent the time learning them yet.
> Thanks.  Shalom Aleichem.
> Jimmie

More information about the Pharo-users mailing list