fclp / fluent-command-line-parser

A simple, strongly typed .NET C# command line parser library using a fluent easy to use interface
Other
530 stars 85 forks source link

Can't get help descriptions for commands #91

Open OsirisTerje opened 6 years ago

OsirisTerje commented 6 years ago

I have set up the system using the non-generic parser, with a set of commands. Each command has a set of options with their descriptions. I have set up the help system using parser.SetupHelp("?", "help").Callback(text => Console.WriteLine(text));

Now calling the app like: myapp gitignore -? After parsing the arguments, I see that the HelpCalled property is true, but the text coming out is just: "No options have been setup"

A typical setup for the commands are like:

var gi = parser.SetupCommand<GitIgnoreCommand>("gitignore").OnSuccess(Execute);
gi.Setup(args => args.Replace).As('r', "replace").SetDefault(false).WithDescription("Replace the existing instead of merging in the latest, applies to all gitignore files");

I would expect the description texts for each option to be displayed.
What am I missing?

siywilliams commented 6 years ago

Hi Terje,

What's the args you've passed into the parser at runtime?

I suspect you've find a bug, your setup looks good.

On 26 Dec 2017 23:03, "Terje Sandstrom" notifications@github.com wrote:

I have set up the system using the non-generic parser, with a set of commands. Each command has a set of options with their descriptions. I have set up the help system using parser.SetupHelp("?", "help").Callback(text => Console.WriteLine(text));

After parsing the arguments, I see that the HelpCalled property is true, but the text coming out is just: "No options have been setup"

A typical setup for the commands are like:

var gi = parser.SetupCommand("gitignore").OnSuccess(Execute); gi.Setup(args => args.Replace).As('r', "replace").SetDefault(false).WithDescription("Replace the existing instead of merging in the latest, applies to all gitignore files");

What am I missing?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fclp/fluent-command-line-parser/issues/91, or mute the thread https://github.com/notifications/unsubscribe-auth/ADfmmUYyew4-ilD0Z6_nnEm-fq03IE52ks5tEXtVgaJpZM4RNDWR .

siywilliams commented 6 years ago

Actually, thinking about it I've not updated the formatter to support commands so this will be why it's not working.

I'll try and sort that out soon, after I've finished these mince pies.

OsirisTerje commented 6 years ago

The command I used was : IFix gitignore -?

All of the code is at https://github.com/OsirisTerje/IFix . The code in question is in Options.cs and SetupCommands.cs. I converted from CommandLineParser to this parser, so you will find remains of the older one still there.

The syntax of IFix follows the command syntax of git, so I liked that you had added the commands.

I also noted that the Object property referred to in the front page readme.md file, is no longer in the parser.
For unit testing the setup, it would be helpful to be able to extract the parsed object. I do that now in the SetupCommands class, but I have to add properties for this, so this should be directly available in the parser. It would also be nice to be able to "globally" disconnect any Execute method, for unit testing the command classes. I have also added that to the setupcommands, but again, would be nice to have that break-out facility in the parser.

talu-zz commented 6 years ago

Any chance the update for the formatter will be released soon? I really like the fluent comand parser (great work!) unfortnuatly I need help texts for the commands...

Perhaps I can provide a pull request if that helps?

winzig commented 4 years ago

Anyone know if any forks have been updated with a fix for this?