dnsjit.lib.parseconf(3)

πŸ“¦
version 1.5.1 Β· 5 versions
, in epel 10, epel 9, fedora 43, fedora 44, ubuntu resolute, ubuntu stonking

πŸ’– dnsjit.lib.parseconf β€” Parse simple config files πŸ’–

okay so bestie, this is dnsjit.lib.parseconf(3), a page from the Library Functions Manual, and it's literally the cutest little config parser you've ever met. no cap.


✨ NAME ✨

dnsjit.lib.parseconf β€” Parse simple config files πŸŽ€


🌸 SYNOPSIS 🌸

  local conf = require("dnsjit.lib.parseconf").new()

  conf:func("config_name", function(k,...)
      print(k,...)
  end)

  conf:file(file)

  print(conf:val("another_config_name"))

πŸ¦‹ DESCRIPTION πŸ¦‹

So this module parses simple config files, and they're based on the config syntax of DSC, drool and the parseconf helper library. iykyk πŸ’…

The rules, bestie, are honestly so simple:

  • Every config begins with a name, then comes the options, and then it ends with a ;. that's the whole vibe.
  • You can put multiple configs on the same line if you want. go off. πŸ”₯
  • The valid option types are: number, float, string, and quoted string. that's it, that's the list.
  • Wanna add a comment? just prefix it with # and the parser will simply not perceive it. main character energy only. ✨

πŸ“ Example

  # Comment
  number 12345;
  float 123.456;
  string string string;
  quoted_string "string string string";
  multi config; on one line;

look at that. gorgeous. flawless. ate and left no crumbs. πŸ‘‘

πŸ’œ Functions

okay now the part you actually came for, the function lineup 🫢

  • Parseconf.new() β€” makes you a brand new Parseconf object. a whole new bestie, freshly spawned. πŸ’–
  • Parseconf:log() β€” hands you back the Log object so you can control the logging of this instance or module. yes you get to be in charge of the logs. iconic.
  • Parseconf:func(name, func) β€” sets up a function to call whenever that config name shows up. like a little "notify me when you see this" pact between you and the parser. πŸŽ€
  • Parseconf:file(fn) β€” parses the given file. feed it a whole file and let it cook. 🌈
  • Parseconf:line(l) β€” parses the given line. just one line, one vibe, one moment. ⭐
  • Parseconf:val(name) β€” gets you the value of a config name. the payoff. the reveal. the moment. πŸ’…

πŸ‘‘ AUTHORS and CONTRIBUTORS πŸ‘‘

The absolute 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/

πŸ’€ BUGS πŸ’€

found an issue? got a feature request? bestie, please don't suffer in silence, use this:

  https://codeberg.org/DNS-OARC/dnsjit/issues

got a question, or just need a hand? hit up:

  admin@dns-oarc.net
ngl they're genuinely nice, so go ahead and ask πŸ™ˆ

and that's the whole page, bestie!! this is from dnsjit version 1.5.1, filed under dnsjit.lib.parseconf(3) in the Library Functions Manual. go forth and parse, you absolute icon πŸŒΈπŸ¦‹βœ¨