Category: Libraries
Addon Information
Download Latest Version.
To add favorites please register for a free account. If you already have one you need to login. How do I install this? (FAQ)
Author:
Version:
0.03
Date:
10-15-2008 02:47 AM
Size:
4.57 Kb
Downloads:
1,338
Favorites:
10
MD5:
GetOpt
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.
  Change Log - GetOpt
Just TOC updates.
  Optional Files - GetOpt
Sorry, there are currently no optional files available.
  Comments - GetOpt
Post A Reply Comment Options
Old 05-02-2009, 05:02 AM  
seebs
A Warpwood Thunder Caller
Interface Author - Click to view interfaces

Forum posts: 95
File comments: 135
Uploads: 5
Re: kudos and feature request (boolean-type)

Quote:
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.
seebs is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 04-13-2009, 07:31 PM  
Macniel
A Fallenroot Satyr
 
Macniel's Avatar
Interface Author - Click to view interfaces

Forum posts: 26
File comments: 125
Uploads: 10
Thumbs down kudos and feature request (boolean-type)

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
Macniel is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Post A Reply



Category Jump:




The Network:
EQInterface | EQ2Interface | LoTROInterface | MMOInterface | War.MMOUI | WoWInterface | VGInterface | Allakhazam | Thottbot | Wowhead | Zam


©2009 MMOUI / ZAM Network
vBulletin - Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.