dnsjit.lib.getopt(3)
π dnsjit.lib.getopt β the manual page, but make it slay π
okay bestie, welcome to dnsjit.lib.getopt(3) from the Library Functions Manual π this is the little Lua module that handles your command line arguments for you, and honestly? it ate.
β¨ 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"))
likeβ¦ look at her. iconic behavior fr fr π
π¦ DESCRIPTION π¦
so this is a "getopt long" implementation, which is a fancy way of saying: it handles your command line arguments and prints a cute usage message when someone messes up. lowkey a whole package.
an option is made of up these five things:
- the short name (just one character, okay? one. single. character.)
- the long name
- the default value β and plot twist, the default value is also what defines the type π
- the help text
- the extensions
and heads up: options are required by default, so if you want them optional you gotta go check the extensions section. no cap.
the Lua types you're allowed to use are boolean, string, and number. that's the whole guest list.
the extensions available are:
?β makes the option optional β¨ (she's flexible, she can show up or not, no pressure)*β forstringandnumberoptions this makes it possible to specify it multiple times, and all the values get returned in a table π+β fornumberoptions this acts as a counter increaser; the value will be the default value + 1 for each time the option is given π₯
also!!!-hand--helpare automatically added, unless the option--helpis already defined. so don't be weird about it, it's handled π
π Attributes π
leftβ a table containing the arguments left over after parsing, same thing thatparse()returns. the leftovers. the afterparty π«Άusage_descβ a string that describes the usage of the program. if you don't set it, the default is" program [options...] "(yes, with the spaces, that's just her vibe)
π Functions π
Getopt.new(args)β create a newGetoptobject.argsis a table of tables, and each inner table specifies the options available. every entry gets unpacked and sent straight toGetopt:add(). it's giving assembly line but make it cute πGetopt:log()β return theLogobject so you can control logging for this instance or module πGetopt:add(short, long, default, help, extensions)β add an option. that's it, that's the function πGetopt:usage()β print the usage. go off bestie π’Getopt:parse(args, startn)β parse the options! ifargsisn't specified or isnil, then the globalarggets used. ifstartnis given, it'll start parsing arguments in the table from that position. the default position to start at is2for dnsjit β go look atdnsjit.core(3)if you wanna know why πGetopt:val(name)β return the value of an option. the moment of truth β¨
π SEE ALSO π
dnsjit.core(3) β go read her too, she's part of the lore π
π AUTHORS and CONTRIBUTORS π
the legends who made this happen:
- Jerry LundstrΓΆm (DNS-OARC)
- TomΓ‘Ε‘ KΕΓΕΎek (CZ.NIC)
- Petr Ε paΔek (ISC)
Maintained by DNS-OARC π«Ά
https://www.dns-oarc.net/
absolute icons, all of them. periodt. π
π BUGS π
found a bug? got a feature request? don't suffer in silence, bestie:
https://codeberg.org/DNS-OARC/dnsjit/issues
got a question and need help? hit up:
admin@dns-oarc.net
they're nice, they won't bite π₯Ί
and that's the whole page!! this was dnsjit.lib.getopt(3) from dnsjit version 1.5.1, dated dnsjit.lib.getopt(3) in the footer, and honestly she understood the assignment πβ¨ππ¦πΈπ
π«Ά no notes, mwah π
π¦ where this page comes from
- epel 10: dnsjit 1.5.1-2.el10_2 Β· GPL-3.0-or-later
- epel 9: dnsjit 1.5.1-2.el9 Β· GPL-3.0-or-later
- fedora 43: dnsjit 1.5.1-2.fc43 Β· GPL-3.0-or-later
- fedora 43: dnsjit 1.5.1-2.fc43 Β· GPL-3.0-or-later
- fedora 44: dnsjit 1.5.1-2.fc44 Β· GPL-3.0-or-later
- fedora 44: dnsjit 1.5.1-2.fc44 Β· GPL-3.0-or-later
- ubuntu resolute: dnsjit 1.5.1-2 Β· GPL-3.0-or-later
- ubuntu stonking: dnsjit-dev 1.5.1-6 Β· GPL-3.0-or-later
- Copyright (c) 2018-2026 OARC, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms