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

Bruce Steers bsteers4 at gmail.com
Thu Jun 30 12:45:54 CEST 2022


On Thu, 30 Jun 2022 at 01:21, Bruce Steers <bsteers4 at gmail.com> wrote:

>
>
> 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.
>

I've modified that Merge request Ben if you are interested in the upgrade.
https://gitlab.com/gambas/gambas/-/merge_requests/267

[gb.args]
* OPT: Remove initial commit of allowing more than one shortname per arg to
also use -? and use a QuestionMark property instead.
* NEW: Property QuestionMark As Boolean, If true -? is used as well as -h
to get args help
* NEW: Property Grouping As Integer, enable/disable grouping shortnames,
disabling allows shortnames to be more than one char
* NEW: Property HelpOnError As Boolean, if an error with arguments then
help text is automatically printed.

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


More information about the User mailing list