commandlineparser / commandlineparser/commandline

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

Đang mở
#838 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C#
Star
4.8k
Fork
478
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.