Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CommandLine/Core/Tokenizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static Result<IEnumerable<Token>, Error> Tokenize(
Action<Error> onError = errors.Add;

var tokens = (from arg in arguments
from token in !arg.StartsWith("-", StringComparison.Ordinal)
from token in (!arg.StartsWith("-", StringComparison.Ordinal) || (arg.Contains(" ") && !arg.Contains("=")))
? new[] { Token.Value(arg) }
: arg.StartsWith("--", StringComparison.Ordinal)
? TokenizeLongName(arg, onError)
Expand Down
21 changes: 21 additions & 0 deletions tests/CommandLine.Tests/Unit/ParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,27 @@ public void Parse_options_with_double_dash()
// Teardown
}

[Fact]
public void Parse_options_with_whitespace_and_double_dash()
{
// Fixture setup
var expectedOptions = new Simple_Options
{
StringValue = "--astring value",
IntSequence = Enumerable.Empty<int>(),
};
var sut = new Parser();

// Exercize system
var result =
sut.ParseArguments<Simple_Options>(
new[] { "--stringvalue", "--astring value" });

// Verify outcome
((Parsed<Simple_Options>)result).Value.Should().BeEquivalentTo(expectedOptions);
// Teardown
}

[Fact]
public void Parse_options_with_repeated_value_in_values_sequence_and_option()
{
Expand Down