Show enum values as argument in help text#276
Show enum values as argument in help text#276natemcmaster merged 12 commits intonatemcmaster:masterfrom
Conversation
natemcmaster
left a comment
There was a problem hiding this comment.
This is a good start! I made a few suggestions below, but overall I like it. The approach here is simple and clean. Thanks!
I suspect this doesn't work on attributes? Have you tried it on a small program like this?
enum Color { Red, Blue }
class Program
{
[Option]
public Color Color { get; }
}|
Also, it looks like there are some test failures on Linux. It looks to me like the HangingIndentWriter is adding new lines, possibly because it is detecting Relevant code to look at: CommandLineUtils/src/CommandLineUtils/HelpText/DefaultHelpTextGenerator.cs Lines 313 to 329 in 76413af CommandLineUtils/src/CommandLineUtils/HelpText/HangingIndentWriter.cs Lines 16 to 34 in 76413af |
d0d2506 to
322363d
Compare
|
PR ready for review again |
When options or arguments are parsed into an enum, the help text will now include the values contained in the enum. fixes natemcmaster#92
Co-Authored-By: Nate McMaster <nate.mcmaster@gmail.com>
Co-Authored-By: Nate McMaster <nate.mcmaster@gmail.com>
Used e.g. for testing. Also made the default constructor public. This allows the DefaultHelpTextGenerator to be instantiated on a per-use basis in order to keep unit tests a isolated from each other as possible. Without that change, all instances would be the same singleton instance - i.e. a test can affect another test by fiddling with the overridden width.
Even though a CommandLineApplication holds lists of `CommandArgument` and `CommandOption` they are not used in the default help text generation.
322363d to
18bb134
Compare
natemcmaster
left a comment
There was a problem hiding this comment.
Thanks for updating! I had a just a few more comments to address about the new public APIs added. Once addressed, I’ll merge this in. I’m planning for this to be part of 2.5, planning to release in a few weeks.
When options or arguments are parsed into an enum, the help text will now include the values contained in the enum.
fixes #92