spectre.console icon indicating copy to clipboard operation
spectre.console copied to clipboard

Add a configuration setting to disable capitalisation of option value placeholders in help output

Open dsparkplug opened this issue 1 year ago • 7 comments

The option value placeholders in the help text are always capitalised.

e.g.

[CommandOption("-d <ItemDescription>")]

produces the following option text in the help output

-d <ITEMDESCRIPTION> 

This appears to be the line of code which does this: TemplateParser.cs#L133

I would like there to be a configuration setting to disable this - as I prefer the help option to be as follows

-d <ItemDescription> 

Please upvote :+1: this issue if you are interested in it.

dsparkplug avatar Aug 21 '24 08:08 dsparkplug

@dsparkplug You are dead right, what a pain.

FrankRay78 avatar Feb 18 '25 22:02 FrankRay78

Hello, I am interested on working on this issue. Can you please assign it to me?

ms-10-us avatar Mar 16 '25 08:03 ms-10-us

I am unable to work on this issue at the moment. Please assign it to someone else. Thanks!

ms-10-us avatar Apr 06 '25 11:04 ms-10-us

Hello, I'm interested in working on it. For the feature, is it only on CommandOption, or maybe other command help output ?

Happistarz avatar May 09 '25 17:05 Happistarz

@Happistarz Sure. This involves option values as well as arguments.

patriksvensson avatar May 09 '25 21:05 patriksvensson

Ok, i will add configuration for the argument and option command help output by creating static booleans in the best related class. Can you please assign this issue to me ? thanks.

Happistarz avatar May 14 '25 21:05 Happistarz

Hey, is this issue still free to pick? I worked on it in my spare time and I might push a PR if you want. If interested you can see the changes on this branch.

In short:

  • Added CapitalizeOptionValuePlaceholders property to ICommandAppSettings and CommandAppSettings (defaults to true for backwards compatibility)
  • Extended TemplateParser.OptionResult to store both original and capitalized value names
  • Updated HelpProvider with the core logic
  • Added DisableOptionValuePlaceholderCapitalization() to easily access this config
  • Added unit tests

Users can disable the placeholder capitalization like this:

var app = new CommandApp();
app.Configure(config =>
{
    config.DisableOptionValuePlaceholderCapitalization();
});

PS Didn't open a PR because the template explicitly says:

Do NOT open a PR without discussing the changes on an open issue, first.

cc: @patriksvensson

antoniovalentini avatar May 30 '25 16:05 antoniovalentini