From 53f9b4f427cc9f83a0f4bc1e0309c48f24fa225b Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Wed, 22 Mar 2017 13:04:58 -0700 Subject: [PATCH 1/6] fix spelling error --- src/dotnet/CommandLine/CommandLineApplication.cs | 2 +- src/dotnet/CommandLine/CommandParsingException.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/dotnet/CommandLine/CommandLineApplication.cs b/src/dotnet/CommandLine/CommandLineApplication.cs index a22e77535..64b6b3d17 100644 --- a/src/dotnet/CommandLine/CommandLineApplication.cs +++ b/src/dotnet/CommandLine/CommandLineApplication.cs @@ -207,7 +207,7 @@ namespace Microsoft.DotNet.Cli.CommandLine throw new CommandParsingException( command, "Required command missing", - isRequireSubCommandMissing: true); + isRequiredSubCommandMissing: true); } return command.Invoke(); diff --git a/src/dotnet/CommandLine/CommandParsingException.cs b/src/dotnet/CommandLine/CommandParsingException.cs index 79e19e522..82c675f4b 100644 --- a/src/dotnet/CommandLine/CommandParsingException.cs +++ b/src/dotnet/CommandLine/CommandParsingException.cs @@ -8,7 +8,7 @@ namespace Microsoft.DotNet.Cli.CommandLine { internal class CommandParsingException : Exception { - private readonly bool _isRequireSubCommandMissing; + private readonly bool _isRequiredSubCommandMissing; public CommandParsingException( string message, @@ -21,11 +21,11 @@ namespace Microsoft.DotNet.Cli.CommandLine public CommandParsingException( CommandLineApplication command, string message, - bool isRequireSubCommandMissing = false) + bool isRequiredSubCommandMissing = false) : this(message) { Command = command; - _isRequireSubCommandMissing = isRequireSubCommandMissing; + _isRequiredSubCommandMissing = isRequiredSubCommandMissing; } public CommandLineApplication Command { get; } @@ -36,7 +36,7 @@ namespace Microsoft.DotNet.Cli.CommandLine { get { - return _isRequireSubCommandMissing + return _isRequiredSubCommandMissing ? CommonLocalizableStrings.RequiredCommandNotPassed : base.Message; } From 055523770a8bbd8decf0e1e4b4624cd5fb04b880 Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Wed, 22 Mar 2017 13:51:09 -0700 Subject: [PATCH 2/6] update CliCommandLineParser version --- src/dotnet/dotnet.csproj | 2 +- test/dotnet.Tests/dotnet.Tests.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dotnet/dotnet.csproj b/src/dotnet/dotnet.csproj index a9c9a6f86..a8d4472d7 100644 --- a/src/dotnet/dotnet.csproj +++ b/src/dotnet/dotnet.csproj @@ -40,7 +40,7 @@ - + diff --git a/test/dotnet.Tests/dotnet.Tests.csproj b/test/dotnet.Tests/dotnet.Tests.csproj index c37528336..f9b8b2d07 100644 --- a/test/dotnet.Tests/dotnet.Tests.csproj +++ b/test/dotnet.Tests/dotnet.Tests.csproj @@ -42,6 +42,6 @@ - + From c58b0b70a60e90f6c0bce0b31b1bc44cdd2beaa6 Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Wed, 22 Mar 2017 13:51:32 -0700 Subject: [PATCH 3/6] add null propagation --- src/dotnet/commands/dotnet-complete/ParseCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dotnet/commands/dotnet-complete/ParseCommand.cs b/src/dotnet/commands/dotnet-complete/ParseCommand.cs index fb86c6300..90972e119 100644 --- a/src/dotnet/commands/dotnet-complete/ParseCommand.cs +++ b/src/dotnet/commands/dotnet-complete/ParseCommand.cs @@ -31,7 +31,7 @@ namespace Microsoft.DotNet.Cli Console.WriteLine(); foreach (var error in result.Errors) { - Console.WriteLine($"[{error?.Option?.Name ?? "???"}] {error.Message}"); + Console.WriteLine($"[{error?.Option?.Name ?? "???"}] {error?.Message}"); } } From 94bc781df730b2219c1af081e2e4539f833840d5 Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Wed, 22 Mar 2017 13:51:45 -0700 Subject: [PATCH 4/6] remove debug file output --- src/dotnet/commands/dotnet-complete/CompleteCommand.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/dotnet/commands/dotnet-complete/CompleteCommand.cs b/src/dotnet/commands/dotnet-complete/CompleteCommand.cs index a8375687a..d188171ac 100644 --- a/src/dotnet/commands/dotnet-complete/CompleteCommand.cs +++ b/src/dotnet/commands/dotnet-complete/CompleteCommand.cs @@ -2,9 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; -using System.IO; using System.Linq; -using System.Text; using Microsoft.DotNet.Cli.CommandLine; using Microsoft.DotNet.Cli.Utils; @@ -28,11 +26,6 @@ namespace Microsoft.DotNet.Cli var suggestions = Suggestions(complete); - var log = new StringBuilder(); - log.AppendLine($"args: {string.Join(" ", args.Select(a => $"\"{a}\""))}"); - log.AppendLine("diagram: " + result.Diagram()); - File.WriteAllText("parse.log", log.ToString()); - foreach (var suggestion in suggestions) { Console.WriteLine(suggestion); @@ -40,8 +33,7 @@ namespace Microsoft.DotNet.Cli } catch (Exception e) { - File.WriteAllText("dotnet completion exception.log", e.ToString()); - throw; + return 1; } return 0; From 4a2c3932e7304dd54266d5850fad1ead1da03e90 Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Wed, 22 Mar 2017 15:26:58 -0700 Subject: [PATCH 5/6] new parser version, adjust column spacing in tests --- .../dotnet-add-reference.Tests/GivenDotnetAddReference.cs | 8 ++++---- .../GivenDotnetListReference.cs | 4 ++-- .../dotnet-remove-reference.Tests/GivenDotnetRemoveP2P.cs | 8 ++++---- test/dotnet-sln-add.Tests/GivenDotnetSlnAdd.cs | 6 +++--- test/dotnet-sln-list.Tests/GivenDotnetSlnList.cs | 4 ++-- test/dotnet-sln-remove.Tests/GivenDotnetSlnRemove.cs | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/test/dotnet-add-reference.Tests/GivenDotnetAddReference.cs b/test/dotnet-add-reference.Tests/GivenDotnetAddReference.cs index 2192205d4..cac2a687d 100644 --- a/test/dotnet-add-reference.Tests/GivenDotnetAddReference.cs +++ b/test/dotnet-add-reference.Tests/GivenDotnetAddReference.cs @@ -19,12 +19,12 @@ namespace Microsoft.DotNet.Cli.Add.Reference.Tests Usage: dotnet add reference [options] Arguments: - The project file to operate on. If a file is not specified, the command will search the current directory for one. - Project to project references to add + The project file to operate on. If a file is not specified, the command will search the current directory for one. + Project to project references to add Options: - -h, --help Show help information - -f, --framework Add reference only when targeting a specific framework + -h, --help Show help information + -f, --framework Add reference only when targeting a specific framework "; const string FrameworkNet451Arg = "-f net451"; diff --git a/test/dotnet-list-reference.Tests/GivenDotnetListReference.cs b/test/dotnet-list-reference.Tests/GivenDotnetListReference.cs index f82c98700..e6205904d 100644 --- a/test/dotnet-list-reference.Tests/GivenDotnetListReference.cs +++ b/test/dotnet-list-reference.Tests/GivenDotnetListReference.cs @@ -18,10 +18,10 @@ namespace Microsoft.DotNet.Cli.List.Reference.Tests Usage: dotnet list reference [options] Arguments: - The project file to operate on. If a file is not specified, the command will search the current directory for one. + The project file to operate on. If a file is not specified, the command will search the current directory for one. Options: - -h, --help Show help information + -h, --help Show help information "; const string FrameworkNet451Arg = "-f net451"; diff --git a/test/dotnet-remove-reference.Tests/GivenDotnetRemoveP2P.cs b/test/dotnet-remove-reference.Tests/GivenDotnetRemoveP2P.cs index 956d380d7..a098e9719 100644 --- a/test/dotnet-remove-reference.Tests/GivenDotnetRemoveP2P.cs +++ b/test/dotnet-remove-reference.Tests/GivenDotnetRemoveP2P.cs @@ -18,12 +18,12 @@ namespace Microsoft.DotNet.Cli.Remove.Reference.Tests Usage: dotnet remove reference [options] Arguments: - The project file to operate on. If a file is not specified, the command will search the current directory for one. - Project to project references to remove + The project file to operate on. If a file is not specified, the command will search the current directory for one. + Project to project references to remove Options: - -h, --help Show help information - -f, --framework Remove reference only when targeting a specific framework + -h, --help Show help information + -f, --framework Remove reference only when targeting a specific framework "; const string FrameworkNet451Arg = "-f net451"; diff --git a/test/dotnet-sln-add.Tests/GivenDotnetSlnAdd.cs b/test/dotnet-sln-add.Tests/GivenDotnetSlnAdd.cs index 8ee3ca5c4..c022a8d1c 100644 --- a/test/dotnet-sln-add.Tests/GivenDotnetSlnAdd.cs +++ b/test/dotnet-sln-add.Tests/GivenDotnetSlnAdd.cs @@ -20,11 +20,11 @@ namespace Microsoft.DotNet.Cli.Sln.Add.Tests Usage: dotnet sln add [options] Arguments: - Solution file to operate on. If not specified, the command will search the current directory for one. - Add one or more specified projects to the solution. + Solution file to operate on. If not specified, the command will search the current directory for one. + Add one or more specified projects to the solution. Options: - -h, --help Show help information + -h, --help Show help information "; private ITestOutputHelper _output; diff --git a/test/dotnet-sln-list.Tests/GivenDotnetSlnList.cs b/test/dotnet-sln-list.Tests/GivenDotnetSlnList.cs index abaa51cea..781322e71 100644 --- a/test/dotnet-sln-list.Tests/GivenDotnetSlnList.cs +++ b/test/dotnet-sln-list.Tests/GivenDotnetSlnList.cs @@ -18,10 +18,10 @@ namespace Microsoft.DotNet.Cli.Sln.List.Tests Usage: dotnet sln list [options] Arguments: - Solution file to operate on. If not specified, the command will search the current directory for one. + Solution file to operate on. If not specified, the command will search the current directory for one. Options: - -h, --help Show help information + -h, --help Show help information "; [Theory] diff --git a/test/dotnet-sln-remove.Tests/GivenDotnetSlnRemove.cs b/test/dotnet-sln-remove.Tests/GivenDotnetSlnRemove.cs index c0e51ff8a..f32bef616 100644 --- a/test/dotnet-sln-remove.Tests/GivenDotnetSlnRemove.cs +++ b/test/dotnet-sln-remove.Tests/GivenDotnetSlnRemove.cs @@ -18,11 +18,11 @@ namespace Microsoft.DotNet.Cli.Sln.Remove.Tests Usage: dotnet sln remove [options] Arguments: - Solution file to operate on. If not specified, the command will search the current directory for one. - Remove the specified project(s) from the solution. The project is not impacted. + Solution file to operate on. If not specified, the command will search the current directory for one. + Remove the specified project(s) from the solution. The project is not impacted. Options: - -h, --help Show help information + -h, --help Show help information "; private const string ExpectedSlnContentsAfterRemove = @" From 857df6a38400ec6fd284a236fb8244165e93a35f Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Wed, 22 Mar 2017 15:47:54 -0700 Subject: [PATCH 6/6] remove unused variable --- src/dotnet/commands/dotnet-complete/CompleteCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dotnet/commands/dotnet-complete/CompleteCommand.cs b/src/dotnet/commands/dotnet-complete/CompleteCommand.cs index d188171ac..a6061d37d 100644 --- a/src/dotnet/commands/dotnet-complete/CompleteCommand.cs +++ b/src/dotnet/commands/dotnet-complete/CompleteCommand.cs @@ -31,7 +31,7 @@ namespace Microsoft.DotNet.Cli Console.WriteLine(suggestion); } } - catch (Exception e) + catch (Exception) { return 1; }