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:
args = GetOpt.getopt("ab:", "-a -b Barney hello there")
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.