Module posix.getopt

Command Line Argument Processing.

Functions

getopt (arg, shortopts[, longopts[, opterr=0[, optind=1]]]) Parse command-line options.


Functions

getopt (arg, shortopts[, longopts[, opterr=0[, optind=1]]])
Parse command-line options.

Parameters:

  • arg command line arguments
  • shortopts string short option specifier
  • longopts table long options table (optional)
  • opterr int index of the option with an error (default 0)
  • optind int index of the next unprocessed option (default 1)

Returns:

    option iterator, returning 4 values

See also:

Usage:

    local longopts = {
      {"help", "none", 1},
      {"version", "none", 3},
    }
    for r, longindex, err, i in P.getopt (arg, "ho:v", longopts, err, i) do
      process (arg, err, i)
    end
generated by LDoc 1.4.3 Last updated 2015-01-04 12:06:34