commandlineparser / commandlineparser/commandline

Backslash parsing problem in argument.

未关闭
#918 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C#
星标
4.8k
派生
478
PR 合并指标
30 天内没有已合并 PR

描述

**Describe the bug**
Read string option with backslash \ and " results in reading " in the string.

**To Reproduce**
```
public class Options
{
[Option('P', "path", Required = true, HelpText = "Set working directory path.")]
public string Path { get; set; }
}

static void Main(string[] args)
{
string path = "";

var result = Parser.Default.ParseArguments(args)
.WithParsed(o =>
{
path = o.Path;
});

if (result.Tag == ParserResultType.Parsed)
{
Console.WriteLine($"Path: {path}");
}
}
```
1. Passing in argument `-P "C:\path\to\read\"`
2. Console output is `Path: C:\path\to\read"`

**Expected behavior**
Read backslash as it is. In the above example, output should be `Path: C:\path\to\read\`

**Additional context**
Am i missing some options?
Ref [issues/226](https://github.com/commandlineparser/commandline/issues/226) reports the same problem, still not fixed?

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。