[Gambas-user] New component: gb.args

Olivier Cruilles linuxos at ...1896...
Tue Oct 16 07:40:48 CEST 2012


Hi Benoit,

Yes, I use it and it very important in my project.

So what king of informations does you need to know about gb.options ? Of curse if you need it.

Cordialement,

Olivier Cruilles
Mail: linuxos at ...1896...

Le 16 oct. 2012 à 02:06, Benoît Minisini <gambas at ...1...> a écrit :

> Hi,
> 
> In the last revision, I added a new component 'gb.args', which replaces 
> the unmaintained 'gb.option'. By the way, does anyone use 'gb.option'?
> 
> The goal of this component made in Gambas is analyzing the command-line 
> arguments and return the value of options.
> 
> It works like that:
> 
> ' Start the analyze : UsageString is an optional string describing
> ' the global syntax of the command with its name.
> 
> Args.Begin(UsageString)
> 
> ' This method returns if an option is present or not, with the form
> ' "-s" or "--long"
> 
> Args.Has("s", "long", ("description"))
> 
> ' This method defines an option that takes one string argument, and
> ' returns it.
> 
> Args.Get("s", "long", ("description"), ("argument name"))
> 
> ' This method defines an option that takes one integer argument, and
> ' returns it. The argument can be prefixed by "0x" for an hexadecimal
> ' number.
> 
> Args.GetInteger("s", "long", ("description"), ("argument name"),
>   DefaultValue)
> 
> ' This method ends the analyze, and returns all extra arguments (that
> ' usually are file paths to process). The arguments are returned into
> ' a String array.
> 
> Args.End()
> 
> Moreover, the End() method automatically handles:
> 
> - An '-h/--help' option that prints the program usage by using the usage 
> string sent to the Begin() function and all option descriptions.
> 
> - A '-V/--version' option that prints the program version.
> 
> Tell me what you think about that component!
> 
> Regards,
> 
> -- 
> Benoît Minisini
> 
> ------------------------------------------------------------------------------
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user




More information about the User mailing list