Closed c-kunz closed 2 months ago
Issue https://github.com/cbeust/jcommander/issues/462 might be related:
So... there isn't any externally defined concept of the
@file
?
JCommander should have a new option which allows using @
as part of parameter values but still recognizes it as file name prefix when used in parameter names. Hence, the old behavior would be the default, but new applications could opt-in to the new behavior.
See also #330.
Hello, I want to try to work on this issue. I plan to modify the judge rule of @-syntax which is inspired by that file name can not start with / in windows and linux.
@c-kunz Thank you for reporting this bug! It was fixed some minutes ago, and will be contained in either 1.83.1 or 1.84 (whatever comes first).
Description
One cannot use the
@
-syntax in conjunction with parameters that may contain a literal@
at the beginning.Steps to reproduce:
In this repository: https://github.com/c-kunz/jcommander-conflicting-at-syntax
Expected result
JCommander is able to parse the argument beginning with the literal
@
while also being able to parse additional arguments using the@
-syntax.Actual result
JCommander interprets the argument starting with a literal
@
as a file containing additional arguments (@
-syntax):Exception in thread "main" com.beust.jcommander.ParameterException: Could not read file X: java.nio.file.NoSuchFileException: X
Workaround
One has to settle for the following workaround, basically disabling the
@
-syntax altogether:Proposal
Since this is an either-or situation, either disabling
@
-syntax or prohibiting arguments starting with a literal@
, it would be nice to be able to for example specify parameters that lookup additional arguments in a file or specify parameters that ignore leading@
signs.