Skip to content
Merged
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/Vertical/CommandLine/Parsing/TokenMatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public sealed class TokenMatcher : ITokenMatcher
private static readonly string CompactShortOptionPattern = $"^-(?<{TemplateIdGroup}>[0-9a-zA-Z]+)$";
private static readonly string LongOptionPattern = $"^--(?<{TemplateIdGroup}>[\\w-]+)$";
private static readonly string WordPattern = $"^(?![\\W])(?<{TemplateIdGroup}>[0-9a-zA-Z-]+)$";
private static readonly string CompositeOptionPattern = $"^--?(?<{TemplateIdGroup}>[0-9a-zA-Z]+)[=:](?<{OperandGroup}>.+)?$";
private static readonly string CompositeOptionPattern = $"^--?(?<{TemplateIdGroup}>[\\w-]+)[=:](?<{OperandGroup}>.+)?$";
private const string OptionsEndPattern = "^--$";
private const string AnyPattern = ".+";

Expand Down
4 changes: 3 additions & 1 deletion test/Parsing/TokenMatcherTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ public void PositiveMatchReturnsTokens(TokenMatcher matcher, string input, Token
Scenario(TokenMatcher.CompositeOption, "-a:", new[]{ new Token(TokenType.CompositeOption, "a")}),
Scenario(TokenMatcher.CompositeOption, "-a=", new[]{ new Token(TokenType.CompositeOption, "a")}),
Scenario(TokenMatcher.CompositeOption, "--long=", new[]{ new Token(TokenType.CompositeOption, "long")}),
Scenario(TokenMatcher.CompositeOption, "--long:", new[]{ new Token(TokenType.CompositeOption, "long")})
Scenario(TokenMatcher.CompositeOption, "--long:", new[]{ new Token(TokenType.CompositeOption, "long")}),
Scenario(TokenMatcher.CompositeOption, "--long-with-dashes:", new[]{ new Token(TokenType.CompositeOption, "long-with-dashes")}),
Scenario(TokenMatcher.CompositeOption, "--long-with-dashes=", new[]{ new Token(TokenType.CompositeOption, "long-with-dashes")})
);

[Theory, MemberData(nameof(NegativeTheories))]
Expand Down