<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Gerald,<br>
<br>
Just pushed a slight variation. Your example works as intended.<br>
<br>
Thanks,<br>
<br>
On 1/14/2023 12:39 PM, Gerald Klix via Cuis-dev wrote:
<blockquote cite="mid:582c987d-251c-a56a-7f24-390b5155711a@klix.ch"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div class="moz-cite-prefix">Hi Juan,<br>
<br>
I had a closer look at your implementation.<br>
It is less code and looks simpler, but it uses offsets and
indexes,<br>
therefore I find it harder to understand.<br>
<br>
It has the following drawbacks/missing features:<br>
<br>
<ol>
<li>It is not possible to pass options to scripts, they are
are all consumed<br>
by the parsing code and then ether honored or ignored.</li>
<li>In order to implement <tt>#lastCommandLineArguments</tt>
properly, you have to look <b>ahead</b> for a <tt>--</tt>.<br>
Of course before parsing, the arguments after <tt>--</tt>
can be stored in an instance variable<br>
</li>
</ol>
I am against implementing feature 1, because<br>
it implies once we add new options understood by Cuis' image,<br>
the options passed to the script would change in a rather
surprising way.<br>
<br>
The attached changes set implements feature 2.<br>
It only adds an instance variable and about 7 lines of code.<br>
With it you can do something like:<br>
<br>
--- snip ---<br>
<tt>squeak -vm-display-null -headless Cuis6.0-5632cli2.image -d
"Smalltalk scriptingArguments do: [ :arg | StdIOWriteStream
stdout nextPutAll: arg; space]. StdIOWriteStream stdout
newLine" a b c dee -d "Smalltalk scriptingArguments do: [ :arg
| StdIOWriteStream stdout nextPutAll: arg; space].
StdIOWriteStream stdout newLine" z y x why -q -- 1 2 3 -o</tt><br>
--- snap ---<br>
<br>
and get the following output:<br>
<br>
--- snip ---<br>
<tt>a b c dee 1 2 3 -o </tt><tt><br>
</tt><tt>z y x why 1 2 3 -o </tt><br>
--- snap ---<br>
<br>
I suppose that should support all sensible uses cases.<br>
I also presume, that all requirements of Dr. Geo are fulfilled.<br>
<br>
<br>
HTH and Best Regards,<br>
<br>
Gerald<br>
<br>
<br>
</div>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich</pre>
</body>
</html>