lua_altgetopt is a MIT-licenced module for Lua programming language for processing application's arguments the same way POSIX getopt(3) and BSD/Solaris getopt_long(3) functions do.
Main features and goals:
Compatibility with POSIX, that is, SUS "Utility Syntax Guidelines" guidelines 3-12 http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html#tag_12_02.
Support for long options, e.g. compatibility with getopt_long(3) C function present in *BSD and Solaris operating systems.
Unlike GNU getopt(3) and getopt_long(3) lua_altgetopt does not permute the contents of argv as it scans. This means lua_altgetopt strictly conforms to POSIX rules of options parsing. GNU getopt(3) and getopt_long(3) are buggy!
Strict error checking, i.e., checks for an incorrect use of options.
Two ways of options handling are provided. See alt_getopt.get_ordered_opts and alt_getopt.get_opts functions.
This module is written in plain Lua.
No extra dependencies.
No hooks, no functional tricks ;-)
install mk-configure on your system, then run the following commands.
# mkcmake all
# mkcmake test
# mkcmake install
Please report bugs here https://github.com/cheusov/lua-alt-getopt/issues
Aleksey Cheusov <vle@gmx.net>