command-line-arguments
command-line-arguments copied to clipboard
Parse error on heredoc-style argument specification on Windows
Hi. Great library, but experienced an issue on Windows, Scala 2.11.12 with the heredoc-style argument specification as per the example:
val initialArgs: Args = """
|run-main CLASampleMain [options]
|Demonstrates the CLA API.
| -i | --in | --input string Path to input file.
gives:
'error] (run-main-8) com.concurrentthought.cla.ParseError: Invalid input: `
[error] Error:Unexpected end of input, expected Opt (line 1, pos 1):
[error]
[error] ^
[error] Nonzero exit code: 1
.. and is resolved by immediately starting the heredoc contents before the line break:
val initialArgs: Args = """ |run-main CLASampleMain [options]
|Demonstrates the CLA API.
| -i | --in | --input string Path to input file.
Unrelated, but it would also be helpful if the docs could explain how to run the example code through SBT.
Thanks for reporting these errors. I'll investigate later today.
I think the bug is a spot in the parsing code where I first split on \n
, which is wrong for Windows. I've changed that and added a test to make sure it handles \n
and \r\n
and doesn't assume that the files originated on the same kind of system (i.e., you parse a Linux-generated file on Windows...)
Right now I'm upgrading the code for Scala 2.13 and making other minor improvements. I'll try to have a new release out over the weekend.
I just released v0.6.0, which I believe fixes the issue. Please let me know if it doesn't! The new jar files might take a few hours to propagate to Maven repos...