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

Benoit Minisini benoit.minisini at gambas-basic.org
Thu Jun 30 14:20:02 CEST 2022


Le 30/06/2022 à 02:21, Bruce Steers a écrit :
> 
> 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

Just let the user handle both cases if he wants, and implement both 
options in the default help management.


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

Sorry, but I don't see the need of that. Don't add unneeded complexity 
to an interface that must be kept as simple as possible. And, by the 
way, 'HelpText' is the name of a property. As a method, you should have 
named it something like 'GetHelpText()', and never let a method both 
returning something and/or print it!

I prefer a 'PrintHelp()' method, that would be used only when the user 
handles the '-h' (or '-?') option itself.

But now that it's in a stable version, we can't remove it. :-(

> 
> 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 don't think that should be optional. I prefer that you remove the 
property and always handle option combination. Long options always begin 
with two minus signs.

Regards,

-- 
Benoît Minisini.


More information about the User mailing list