Support JCommander-style parameter files
See original GitHub issueIt is possible that this is a feature, but I did not find it in the documentation. See my Github repo for a complete reproducer.
Steps to reproduce
Create an argument file argFile
such as this:
-f "C:\Users\me\somefile.txt"
Run Picocli like this:
CommandLine.run(..., "@argFile");
Observe that the value of the String
-typed Option
has been changed to C:UsersmesomeFile.txt
.
Additional information
- When the value is not quoted, everything works fine. This suggests a problem with not escaping the Windows backslash character. However, the quotes are used in order not to have to escape whitespace characters and therefore this workaround creates a different problem - either I escape the backslashes or the whitespace.
- When the value is kept quoted but passed directly on the command line (as opposed to the argument file), the problem no longer shows up. Unfortunately, the code will include the quotes in the resulting value. There is a second test included to showcase that problem.
Issue Analytics
- State:
- Created 5 years ago
- Comments:28 (28 by maintainers)
Top Results From Across the Web
How to create and use Parameter files? - Forums - IBM Support
I know how to set parameters in the Jobs and Sequences. But in that I have enter these parameters during run time. My...
Read more >Parameter Files - Oracle Help Center
Create the parameter file using any flat file text editor. The command-line option PARFILE= filename tells Export to read the parameters from the...
Read more >Create Resource Manager parameter file - Azure
Create parameter file for passing in values during deployment of an Azure Resource Manager template.
Read more >Manage Parameter Files
You can customize and import parameter XML files for devices. ... Note: The Universal Device Manager does not support the getAll command for...
Read more >HOW TO : Use Parameter Files with startworkflow on different ...
Integration Service runs the workflow using the parameters in the file you specify. For UNIX shell users, enclose the parameter file name in ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I was thinking this weekend.
About the second issue you mention, that
"
quote values are preserved when specified on the command line: this is by design but is configurable.You can switch this off with
commandLine.setTrimQuotes(true)
.