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 86 forks source link

Help default output syntax not standard.. make extensible or change? #34

Open Meai1 opened 9 years ago

Meai1 commented 9 years ago

Output of --help:

p:Platform MyDescription
s:Syntax Syntax for the state machine

is not really helpful. It does not tell the user that he has to actually pass via - or -- And the description should be on the next line indented, this way you would also avoid the weird look because currently you just do a specific amount of spaces/tabs and if the arg string length is different, the descriptions all start at a different indention level. And the help should be displayed by default if no args were parsed.

Desired output of --help

-p --platform (Required)
     MyDescription
-s --syntax 
     Syntax for the state machine

So this is the kind of format you expect on linux tools and I think it would be very readable.

siywilliams commented 9 years ago

Thanks Meai1

I'm surprised I've got away this long with having such a bad help formatter. I have actually been working on a better implementation in the formatter branch.

You can specify a different formatter to use when you setup the help option (if you wanted to roll your own):

var parser = new FluentCommandLineParser();
parser.SetupHelp("?").WithCustomFormatter(new CommandLineOptionFormatterMark2());

If you wanted to try out the new formatter you can either grab the formatter build from TeamCity, or copy the CommandLineOptionFormatterMark2 class into your project and add it to the parser using WithCustomerFormatter(ICommandLineOptionFormatter)

Although not exactly as you described, it does produce output like the following

-p, --platform  MyDescription
-s, --syntax    Syntax for the state machine

I'm hoping to find some time to release these improvement as well as others soon.

brecko commented 8 years ago

Great library btw. When do you think this will be included in the released version on NuGet? I am starting to get requests from user to have the format better aligned...