Repository navigation
fix: commenting of descriptions with embedded newlines - #592
Conversation
|
FYI, the failed appveyor job appears to have been caused by a failed download of a build requisite, |
|
Could you add a little test for this? Otherwise, I will, but it will likely get merged faster if you add one. There's a file with config tests in it. |
Codecov Report
@@ Coverage Diff @@
## master #592 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 12 12
Lines 3764 3764
=========================================
Hits 3764 3764
Continue to review full report at Codecov.
|
|
Although I'm pretty sure I could implement a few tests, I am pressed for time and wouldn't know where to start to begin with. I guess things will move along faster if you add the tests. |
|
Just noticed the merge conflict. Appears to have been introduced due to #593 submitted by me 😮 Should be straightforward to fix. |
|
Can you paste an example config file to use in test, possibly? I don't mind making the test, but having an example file will help. |
|
I had opportunity to fiddle with my application's command line so put some time aside to add tests for my changes. Looking over a few existing tests was enough to get me up to speed 😅 Adding tests, I discovered that only the first hunk of my merge request is strictly needed. It will address all multi-line descriptions. The other two hunks address multi-line group names and multi-line subcommands. The latter would be extremely cumbersome to use on the command-line. The former, multi-line group names, is very unlikely. This made me wonder what to do. Currently, one is able to set multi-line group names and subcommands. If one does, |
|
Oops! Just noticed that subcommands already check for embedded newlines and throw when they find one. That leaves group names. I'm inclined to add validation for those rather than allow embedded newlines. What do you think? |
|
My inclination would be to put the same check on group names as is on subcommands. |
|
A quick search shows that |
|
Hmm, group names in the tests use spaces. These aren't allowed in subcommands so that needs a bit of extra tinkering ... |
This adds tests for the application's description as well as option groups and subcommands. See CLIUtils#592.
|
I'll do the group name validation in a separate PR. |
|
we had some discussion earlier about relaxing the restrictions on subcommand names, to allow other characters, basically everything but |
|
OK. Then I won't be submitting a group name validation PR. Saves me some work 😉 |
|
Fantastic, thank you! |
Anything written in
write_descriptions-guarded code blocks should assume that whatever text is provided by library users may contain embedded newlines. This fixes the places where this wasn't done.