Very simply, this is a clone of the classic UNIX getopt() function, loved by developers everywhere because parsing options is annoying.
Hand this a command line, and watch it magically extract flags from it. Uses UNIX conventions -- "-a" or "--absolute", not "/a" or just a keyword. Small and fairly lightly tested, but it does what I want.
Not following what I just said? Imagine that you want a slash command to accept a number of arguments. You hand your command line to getopt:
Now, args["a"] = true, args["b"] = Barney, and args["leftover"] = "hello there". You can pass the arguments in as a string or as a table; if a string, it is parsed automatically, including trying to handle simple command-line quoting.
Basically, this does all the annoying stuff you usually have to do to parse a command line.
Originally posted by Macniel Good job on this Library, it works like a charm; but when you Parse -? (--help , too?) and you haven't set up a -? parameter yet you encounter a "-? is an unkown parameter" but you get, as expected, the parameter list.
I would, if I may, request more parameter types such as boolean that would be very cool
I'm not quite sure I get the boolean thing -- plain old options are booleans by default. If "-a" doesn't take an argument, then it's a boolean which is set if you provide it and not set otherwise. Effectively.
Good job on this Library, it works like a charm; but when you Parse -? (--help , too?) and you haven't set up a -? parameter yet you encounter a "-? is an unkown parameter" but you get, as expected, the parameter list.
I would, if I may, request more parameter types such as boolean that would be very cool