[Cuis-dev] [IMPROV] Configurable command line exception handling
Juan Vuletich
juan at cuis.st
Sat Jan 14 16:03:30 PST 2023
Hi Gerald,
Just pushed a slight variation. Your example works as intended.
Thanks,
On 1/14/2023 12:39 PM, Gerald Klix via Cuis-dev wrote:
> Hi Juan,
>
> I had a closer look at your implementation.
> It is less code and looks simpler, but it uses offsets and indexes,
> therefore I find it harder to understand.
>
> It has the following drawbacks/missing features:
>
> 1. It is not possible to pass options to scripts, they are are all
> consumed
> by the parsing code and then ether honored or ignored.
> 2. In order to implement #lastCommandLineArguments properly, you
> have to look *ahead* for a --.
> Of course before parsing, the arguments after -- can be stored
> in an instance variable
>
> I am against implementing feature 1, because
> it implies once we add new options understood by Cuis' image,
> the options passed to the script would change in a rather surprising way.
>
> The attached changes set implements feature 2.
> It only adds an instance variable and about 7 lines of code.
> With it you can do something like:
>
> --- snip ---
> 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
> --- snap ---
>
> and get the following output:
>
> --- snip ---
> a b c dee 1 2 3 -o
> z y x why 1 2 3 -o
> --- snap ---
>
> I suppose that should support all sensible uses cases.
> I also presume, that all requirements of Dr. Geo are fulfilled.
>
>
> HTH and Best Regards,
>
> Gerald
>
>
--
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230114/798966e9/attachment.htm>
More information about the Cuis-dev
mailing list