Skip to content

cheusov/lua-alt-getopt

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Description

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.

Features

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 ;-)

Installation:

install mk-configure on your system, then run the following commands.

# mkcmake all
# mkcmake test
# mkcmake install

Bug reports

Please report bugs here https://github.com/cheusov/lua-alt-getopt/issues

Author

Aleksey Cheusov <vle@gmx.net>