From d597e085185e1c5b271f5b8989f73794c5d71249 Mon Sep 17 00:00:00 2001 From: Kahbazi Date: Thu, 20 Feb 2020 20:46:05 +0330 Subject: [PATCH] Make user-secrets treat unmatched options as arguments (#18256) --- src/Tools/dotnet-user-secrets/src/CommandLineOptions.cs | 2 +- src/Tools/dotnet-user-secrets/test/SecretManagerTests.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Tools/dotnet-user-secrets/src/CommandLineOptions.cs b/src/Tools/dotnet-user-secrets/src/CommandLineOptions.cs index 8495b6de9d..7d998f77d7 100644 --- a/src/Tools/dotnet-user-secrets/src/CommandLineOptions.cs +++ b/src/Tools/dotnet-user-secrets/src/CommandLineOptions.cs @@ -19,7 +19,7 @@ namespace Microsoft.Extensions.SecretManager.Tools public static CommandLineOptions Parse(string[] args, IConsole console) { - var app = new CommandLineApplication() + var app = new CommandLineApplication(treatUnmatchedOptionsAsArguments: true) { Out = console.Out, Error = console.Error, diff --git a/src/Tools/dotnet-user-secrets/test/SecretManagerTests.cs b/src/Tools/dotnet-user-secrets/test/SecretManagerTests.cs index 8d62c065d9..c3633b57be 100644 --- a/src/Tools/dotnet-user-secrets/test/SecretManagerTests.cs +++ b/src/Tools/dotnet-user-secrets/test/SecretManagerTests.cs @@ -93,7 +93,9 @@ namespace Microsoft.Extensions.SecretManager.Tools.Tests new KeyValuePair("key1", Guid.NewGuid().ToString()), new KeyValuePair("Facebook:AppId", Guid.NewGuid().ToString()), new KeyValuePair(@"key-@\/.~123!#$%^&*())-+==", @"key-@\/.~123!#$%^&*())-+=="), - new KeyValuePair("key2", string.Empty) + new KeyValuePair("key2", string.Empty), + new KeyValuePair("-oneDashedKey", "-oneDashedValue"), + new KeyValuePair("--twoDashedKey", "--twoDashedValue") }; var projectPath = _fixture.GetTempSecretProject();