From 747792f68d2d5dc9bd61a8a0611a14a8c72f026b Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 9 Dec 2021 16:59:10 -0700 Subject: [PATCH 1/2] Fixes #49 --- src/Vertical/CommandLine/Parsing/TokenMatcher.cs | 2 +- test/Parsing/TokenMatcherTests.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Vertical/CommandLine/Parsing/TokenMatcher.cs b/src/Vertical/CommandLine/Parsing/TokenMatcher.cs index f4d55d8..fa29357 100644 --- a/src/Vertical/CommandLine/Parsing/TokenMatcher.cs +++ b/src/Vertical/CommandLine/Parsing/TokenMatcher.cs @@ -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 = ".+"; diff --git a/test/Parsing/TokenMatcherTests.cs b/test/Parsing/TokenMatcherTests.cs index aae9ef2..176ffc5 100644 --- a/test/Parsing/TokenMatcherTests.cs +++ b/test/Parsing/TokenMatcherTests.cs @@ -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))] From 513637f71980f5a69e5e21db6fc22025bedc8323 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 9 Dec 2021 17:03:36 -0700 Subject: [PATCH 2/2] Closes #51 --- .github/workflows/dev-build.yml | 2 +- .github/workflows/pre-release.yml | 2 +- .github/workflows/release.yml | 2 +- README.md | 2 +- src/Vertical.CommandLine.csproj | 2 +- test/Vertical.CommandLine.Tests.csproj | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index e386ea6..9c09b6f 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - dotnet-version: ['5.0.x'] + dotnet-version: ['6.0.x'] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index f00dbbf..da578f2 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - dotnet-version: ['5.0.x'] + dotnet-version: ['6.0.x'] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c9d6043..e7fa664 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - dotnet-version: ['5.0.x'] + dotnet-version: ['6.0.x'] steps: - uses: actions/checkout@v2 diff --git a/README.md b/README.md index 768719e..ec9c382 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ An easily configured command line arguments parser that makes short work of turning those pesky `string[] args` into a strongly-typed configuration object. -![.net](https://img.shields.io/badge/Frameworks-.netstandard21+net50-purple) +![.net](https://img.shields.io/badge/Frameworks-.netstandard2.0+.netstandard2.1+net5.0+net6.0-purple) ![GitHub](https://img.shields.io/github/license/verticalsoftware/vertical-commandline) ![Package info](https://img.shields.io/nuget/v/vertical-commandline.svg) diff --git a/src/Vertical.CommandLine.csproj b/src/Vertical.CommandLine.csproj index 1531b03..a34dd01 100644 --- a/src/Vertical.CommandLine.csproj +++ b/src/Vertical.CommandLine.csproj @@ -1,6 +1,6 @@  - netstandard2.0;netstandard2.1;net5.0 + netstandard2.0;netstandard2.1;net5.0;net6.0 8.0 True diff --git a/test/Vertical.CommandLine.Tests.csproj b/test/Vertical.CommandLine.Tests.csproj index 1a443de..a035b15 100644 --- a/test/Vertical.CommandLine.Tests.csproj +++ b/test/Vertical.CommandLine.Tests.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 false true ..\assets\Vertical.CommandLine.snk