Some questions about Command-line argument parser library

matthias_livecode_150811 at matthias_livecode_150811 at
Mon Oct 18 18:04:50 EDT 2021


thank you very much for your explanations.

It works now.

Would  you please be so kind to also explain what for the argumentArray can be used?

GetOpt(grammar [, argumentArray])

Okay, i could use it for testing in the LC IDE, so i do not need to compile and execute the standalone. 
But is there another scenario where it would make sense to include that array in the call?

And while i am already asking... ;) 

The environment function can also return "development command line"
The dictionary says about that : The stack is running in the development environment with the "-ui" command line option.

So would i be able to run a stack by running the LC IDE with -ui, add the stack as parameter and add also command line options, which then could be parsed with getop()?



> Am 18.10.2021 um 16:30 schrieb Mark Waddingham via use-livecode <use-livecode at>:
> On 2021-10-18 15:14, matthias rebbe via use-livecode wrote:
>> Hello,
>> is there anyone who uses the Command-line argument parser library?
>> I am not sure how i can get the value that is attached as parameter
>> when the programm is started from the command-line
>> Let's say i call my program like this      ./myprogram -m=SomeParam
>> So how do i get the value SomeParam?I thought it is in the array after
>> getop() is called.
>> My code looks like this
>> put getopt("m,macadress") into tParams
>> if "macadress" is among the keys of tParams["options"]
>> then put tParams["options"]["macadress"] into tValue
> You are using it correctly - but I think you've omitted a `=` from the end of the option specification:
> Each option specification can end with a `=`.  This indicates that
> the option expects an argument.  For example, with the grammar
> `-o,--output=`, the option can be specified like `-o file`, `-ofile`,
> `--output file`, or `--output=file`.
> [ FWIW there is a 'typo' in the docs there the grammer being exhibited should be `o,output=` I think! ]
> Warmest Regards,
> Mark.
> -- 
> Mark Waddingham ~ mark at ~
> LiveCode: Everyone can create apps
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:

More information about the use-livecode mailing list