Closed mkarg closed 2 years ago
@cbeust I don't know if it was by intention that you enforced the values of arguments to be on a separate line below the name of option, but with this change the end user now can opt whether to stay with the two-lines syntax or go with a (more intuitive) single-line syntax ("--foo X"). Would be glad if you would adopt my change proposal. :-)
Looking at what my PR currently does, it might be better to change the regex in a way that allows to limit the line split to a single one, so the value actually can contain blanks, like this:
--foo bar baz
(which aligns with the possibility of the inline argument --foo "bar baz"
).
For example, just apply the split "just once", not "for each".
Or we could actually check the quotes, just like the command line does?
WDYT?
Would you mind adding a test?
I would be glad to add a test, but we should first clarify the behavior it shall assert: Do we want the solution as-is (i. e. truncate at EACH blank) or do we instead want to "truncate at FIRST blank"?
@cbeust Initial test "as-is" can be found in https://github.com/cbeust/jcommander/pull/533/commits/eee072ab324206ea6089676aad55b60fe3aba6cc. If we agree upon blank handling within values, I will modify it.
Fixed #532