commandlineparser / commandlineparser/commandline

Backslash parsing problem in argument.

オープン
#918 コメント 1 件 リアクション 1 件 担当者 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 を短くまとめたダイジェスト。