[Mono-devel-list] Mono.GetOptions

A Rafael D Teixeira rafaelteixeirabr at hotmail.com
Tue Jul 6 12:32:05 EDT 2004


>From: Marcus <mathpup at mylinuxisp.com>

Hi, Marcus

Just to clarify: I'm the original developer of Mono.GetOptions, and still 
the main one.

>I'm trying to use the Mono.GetOptions class, but it appears that certain
>styles of options are not possible to use with the current implementation.

Yeah, we have a blend of styles to accomodate, making gnuish as windowish 
command lines possible. So we have compromises.

>For example, to provide Windows-style syntax, I need to handle
>"/a:name=value".

Currently you can use the non-optimal comma-pairing

/a:name,value

also accepted in the /a name,value and /a=name,value

The problem is that Mono.GetOptions would not help a lot in that case. You 
would need to now that sequential values are to be treated in pairs... We 
will try to remedy it....

>Unfortunately, GetOptions believes that this represents
>option "a" with parameter "name", and then another parameter value, which
>does not begin with "-" or "/", so it leaves it alone.

>The problem is that ":" and "=" are both used to split the arguments, to
>permit "/b:banana" and "/b=banana". For certain parameters in Windows-style
>syntax, the context does need to be considered.

You can restrict a bit parsing, by choosing to not support gnu-style (there 
is a flag enum that governs it), but yes some cases aren't so well treated, 
because of the compromises (the worst of them is having to support both 
styles in the same command line)

>Has this been a problem for anyone else? Is anyone interested in a 
>solution,
>is I happen to see about working on it?

Yes, the idea I have just now is to associate parsing name-value pairs, 
using the syntax you presented, only for types that implement IDictionary, 
so there'd be a natural semantical match.

>I see that Rafael did the last few bugfixes, so I don't know if the 
>original author still is interested.

I came up with Mono.GetOptions long ago, because I needed it in mbas, and 
since then some people has enjoyed using it inside mono utilities and 
elsewhere. But Miguel told me today, that we need to discuss it better, to 
make it a better tool to more developers.

I'm addicted to it, just can't do imperative parsing of options anymore, but 
I want it to be as usefull as possible, so ...

... suggestions and patches are welcome.

>Marcus

Fun,

Rafael "Monoman" Teixeira
Mono Hacker since 16 Jul 2001 - http://www.go-mono.org/
MonoBrasil Founding Member - Membro Fundador do MonoBrasil 
http://monobrasil.softwarelivre.org
English Blog: http://monoblog.blogspot.com/
Brazilian Portuguese Blog: http://monoblog.weblogger.terra.com.br/

_________________________________________________________________
MSN Messenger: instale grátis e converse com seus amigos. 
http://messenger.msn.com.br




More information about the Mono-devel-list mailing list