Provided by: dnsjit_1.3.0-1build2_amd64 bug

NAME

       dnsjit.lib.getopt - Parse and handle arguments

SYNOPSIS

         local getopt = require("dnsjit.lib.getopt").new({
             { "v", "verbose", 0, "Enable verbosity", "?+" },
             { nil, "host", "localhost", "Set host", "?" },
             { "p", nil, 53, "Set port", "?" },
         })

         local left = getopt:parse()

         print("host", getopt:val("host"))
         print("port", getopt:val("p"))

DESCRIPTION

       A  "getopt  long" implementation to easily handle command line arguments and display usage.  An option is
       the short name (one character), long name, default value (which also defines the  type),  help  text  and
       extensions.  Options are by default required, see extensions to change this.

       The Lua types allowed are boolean, string, number.

       The extensions available are:

       ?      Make the option optional.

       *      For  string and number options this make it possible to specified it multiple times and all values
              will be returned in a table.

       +      For number options this will act as an counter increaser, the value will be the default value +  1
              for each time the option is given.

       Option -h and --help are automatically added if the option --help is not already defined.

   Attributes
       left   A table that contains the arguments left after parsing, same as returned by parse().

       usage_desc
              A  string  that  describes the usage of the program, if not set then the default will be " program
              [options...]  ".

   Functions
       Getopt.new(args)
              Create a new Getopt object.  args is a table with tables that  specifies  the  options  available.
              Each entry is unpacked and sent to Getopt:add().

       Getopt:log()
              Return the Log object to control logging of this instance or module.

       Getopt:add(short, long, default, help, extensions)
              Add an option.

       Getopt:usage()
              Print the usage.

       Getopt:parse(args, startn)
              Parse  the  options.   If  args is not specified or nil then the global arg is used.  If startn is
              given, it will start parsing arguments in the table from that position.  The default  position  to
              start at is 2 for dnsjit, see dnsjit.core(3).

       Getopt:val(name)
              Return the value of an option.

SEE ALSO

       dnsjit.core(3)

AUTHORS and CONTRIBUTORS

       Jerry Lundström (DNS-OARC), Tomáš Křížek (CZ.NIC), Petr Špaček (ISC)

       Maintained by DNS-OARC

              https://www.dns-oarc.net/

BUGS

       For issues and feature requests please use:

              https://github.com/DNS-OARC/dnsjit/issues

       For question and help please use:

              admin@dns-oarc.net

dnsjit                                                1.3.0                                 dnsjit.lib.getopt(3)