[Pharo-project] New Command Line Behavior

Sven Van Caekenberghe sven at beta9.be
Thu Jul 5 18:02:36 EDT 2012


On 05 Jul 2012, at 23:27, Camillo Bruni wrote:

> On 2012-07-05, at 21:36, Sven Van Caekenberghe wrote:
> 
>> Hi (Camillo),
>> 
>> Is there some place that describes the new features of the command line ? ;-)
> 
> If any place then the class comment of CommandLineHandler ;P

OK, got it.

--version
--list
--copyright

nice.

>> I was just trying a bit right now (in Linux, latest VM, latest mage).
>> 
>> It seems that just starting an image with no args results in it reading an expression from stdin, right ? But I have to do a ctrl-d to end the input and have it evaluated and printed. And then the image quits, no repl loop ?
> 
> There was an issue with that Guillermo reported, so for now this has been deactivated.
> You have to explicitly enable the 'eval' handler to read from pipe in. 
> So far it will just try to read from stind unit it #atEnd returns true, I guess that is not
> fully compliant with the standard behavior of linux scripts :P

a basic --repl handler would be handy I guess

> REPL: I have a multiline history repl in alpha state:
> http://smalltalkhub.com/#!/~dh83/readline
> 
> It currently needs some more documentation, but I guess I can make it go into the
> 2.0 default image next week or so, then people can start to give some feedback.

readline would be very nice indeed, although it is another dependency.

>> Also for the eval option, it does not work, unless I do a ctrl-d manually. You once posted this example:
>> 
>> ./bin/CogVM -vm-display-null -vm-sound-null Pharo-2.0.image eval '1+2'
>> 
>> Should it still work ?
> 
> yes that should still work, either with 'eval' or '-e' à la ruby ;)

that is was my main point, it doesn't work.

EvaludateCommandLineHandler>>activate
	self evaluateStdIn.
	self evaluateArguments.
	self quit.

always triies to read from stdin, so it needs a crtl-d to end, reading nothing, printing nil, only then will the args be evaluated as you describe.

It goes like

ubuntu at ip-10-48-234-254:~/pharo2$ ./bin/CogVM -vm-display-null -vm-sound-null Pharo-2.0.image eval 1+2
<CTRL-D>
nil
3
ubuntu at ip-10-48-234-254:~/pharo2$

Maybe it also depends on whether the invocation is from an interactive terminal or a shell script..

Sven

>> Sven
>> 
>> PS: the colored error output it cool !





More information about the Pharo-dev mailing list