commandlineparser / commandlineparser/commandline

SplitArgs() extension method does not properly handle arguments with quoted values

オープン
#838 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
C#
スター
4.8k
フォーク
478
PR マージ指標
30日以内にマージされた PR はありません

説明

I attempted to use SplitArgs() to split an string provided by a user while the console app is running (via Console.ReadLine()) and the result of it is different than if the user entered the string on the command prompt as part of launching.

Here is a concrete example:

`myprogram.exe cool-command --arg1="Howdy Partner" --arg2=arg_without_spaces`

Entering this from the command prompt will give you the following args in the args[] array.
* `cool-command`
* `--arg1=Howdy Partner`
* `--arg2=arg_without_spaces`

while SplitArgs() will give me the following

* `cool-command`
* `--arg1="Howdy Partner`
* `--arg2=arg_without_spaces`

Notice there is a quote before Howdy Partner and there is no trailing quote. I would expect no quotes at all.

I looked into alternate implementation and found this which worked correctly for me: https://stackoverflow.com/a/64236441/1571903

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。