GetOpt library for parsing command line options

Peter TB Brett peter.brett at livecode.com
Mon Jun 20 07:39:02 EDT 2016


Hey folks,

I've written a new "GetOpt" script library for parsing UNIX-style 
command line options.  I'll be using it for developing some command-line 
tooling used during the LiveCode development process.

It supports lots of different ways of specifying command line options:

* Short options (-h)
* Combined short options ("-h -v" is the same as "-hv")
* Short options with arguments ("-Werror" / "-W error")
* Long options (--help)
* Long options with arguments ("--output=foo" / "--output foo")

It also supports the special "--" meta-option for ending command-line 
parsing, reports misuse of options in a useful way, and gathers up 
non-option arguments.

Here's the PR, in case you want to grab the code:

https://github.com/livecode/livecode/pull/4178

I don't expect it will be installed as part of LiveCode until the IDE 
has a better user experience for developing command-line applications, 
but it might be fun to play with for people who are interested in that 
sort of thing.

                                                Peter

-- 
Dr Peter Brett <peter.brett at livecode.com>
LiveCode Technical Project Manager

LiveCode 2016 Conference: https://livecode.com/edinburgh-2016/




More information about the use-livecode mailing list