[Gambas-user] Args help , most other places is -?

Bruce Steers bsteers4 at gmail.com
Thu Jun 30 02:21:33 CEST 2022


On Wed, 29 Jun 2022, 23:12 Benoit Minisini, <
benoit.minisini at gambas-basic.org> wrote:

> Le 29/06/2022 à 13:51, Bruce Steers a écrit :
> > I just noticed something in the Args.class
> >
> > Help is checked like this..
> >
> >      If Has("h", "help", ("Display this help")) Then
> >
> > I have noticed most other software uses -? not -h as the short name.
> >
> > I've edited gb.args Args.Has to be able to use more than one char for
> > shortname
> >
> > Eg..
> > Args.Has("?h", "help", "Show this help")
> >
> > will work with either -?  or -h
> >
> > What do you think Ben?
> > I've submitted a merge request..
> >
> > Respects
> > BruceS
> >
>
> I don't see the need for that: '-?' and '-h' being synonymous is the
> only sane case I can imagine (because you want help, and so you don't
> know the options).


Fair point. Now I'm thinking harder I can't think of any other reason
myself other than -?
Maybe I could make it check for -? With a property?  Args.QuestionMarkIsHelp

Another point: I didn't notice that you added a 'Args.HelpText()' method
> with an optional argument. It's quite an ugly interface! Why whould you
> need the automatically generated text as a string instead of printing it?
>

To begin with the Args.HelpText() method did not have an option to print it
just returned the text for printing with 'Print Args HelpText()'
I guess I thought printing it would be most used so I added the option.
Clearly I am not as sane as you 🤪
I think it has uses. The arg descriptions could contain Subst() tokens and
be customised at runtime using the text.

Am adding a boolean property to the class due to what other Bruce said
called Args.ExpandShortNames. if true It stops an arg like -ab being seen
as -a and -b and sees it as -ab.

Respects
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220630/051f1ca7/attachment-0001.htm>


More information about the User mailing list