Closed
Description
Hello,
When using value options with dash inside some of them, the generated command line generated by the FormatCommandLine method is not correct.
public class SimpleOptions
{
[Option("option1")]
public string Option1 { get; set; }
[Value(0, MetaName = "command")]
public string Command { get; set; }
[Value(1, MetaName = "arguments")]
public IEnumerable<string> Arguments { get; set; }
}
var commandOpts = new SimpleOptions();
commandOpts.Option1 = "test";
commandOpts.Command = "powershell";
commandOpts.Arguments = new List<string>() { "-version", "3.0", "D:\\test.ps1" };
var result = parser.FormatCommandLine(commandOpts);
The sample with generate --option1 test powershell -version 3.0 D:\test.ps1 but "-version" switch will be detected by the library as an invalid option and will raise an error.
It might be good to use the dash dash syntax with the unparser to avoid the issue.
Expected result: --option1 test -- powershell -version 3.0 D:\test.ps1
What do you think ?
I will send a PR shortly.
Metadata
Metadata
Assignees
Labels
No labels