Some questions about Command-line argument parser library

Mark Waddingham mark at livecode.com
Mon Oct 18 10:30:54 EDT 2021


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.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the use-livecode mailing list