From d251734170964a2ae8ea39d12fb737f0df6c681b Mon Sep 17 00:00:00 2001 From: Zlatko Knezevic Date: Wed, 15 Mar 2017 07:24:00 -0700 Subject: [PATCH] Responding to PR feedback --- src/dotnet/BuiltInCommandMetadata.cs | 2 +- src/dotnet/BuiltInCommandsCatalog.cs | 36 +++++++++---------- .../commands/dotnet-help/HelpCommand.cs | 9 ++--- ...ivenThatIWantToShowHelpForDotnetCommand.cs | 2 +- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/dotnet/BuiltInCommandMetadata.cs b/src/dotnet/BuiltInCommandMetadata.cs index 7f7bf009b..bb2d48181 100644 --- a/src/dotnet/BuiltInCommandMetadata.cs +++ b/src/dotnet/BuiltInCommandMetadata.cs @@ -5,6 +5,6 @@ namespace Microsoft.DotNet.Cli public class BuiltInCommandMetadata { public Func Command { get; set; } - public Uri DocLink { get; set; } + public string DocLink { get; set; } } } \ No newline at end of file diff --git a/src/dotnet/BuiltInCommandsCatalog.cs b/src/dotnet/BuiltInCommandsCatalog.cs index d7dce8e37..16b0b5331 100644 --- a/src/dotnet/BuiltInCommandsCatalog.cs +++ b/src/dotnet/BuiltInCommandsCatalog.cs @@ -29,110 +29,110 @@ namespace Microsoft.DotNet.Cli { Command = AddCommand.Run, // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-add-reference - DocLink = new Uri("https://aka.ms/dotnet-add") + DocLink = "https://aka.ms/dotnet-add" }, ["build"] = new BuiltInCommandMetadata { Command = BuildCommand.Run, // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-build - DocLink = new Uri("https://aka.ms/dotnet-build") + DocLink = "https://aka.ms/dotnet-build" }, ["cache"] = new BuiltInCommandMetadata { Command = CacheCommand.Run, // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-cache - DocLink = new Uri("https://aka.ms/dotnet-cache") + DocLink = "https://aka.ms/dotnet-cache" }, ["clean"] = new BuiltInCommandMetadata { Command = CleanCommand.Run, // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-clean - DocLink = new Uri("https://aka.ms/dotnet-clean") + DocLink = "https://aka.ms/dotnet-clean" }, ["help"] = new BuiltInCommandMetadata { Command = HelpCommand.Run, // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-help - DocLink = new Uri("https://aka.ms/dotnet-help") + DocLink = "https://aka.ms/dotnet-help" }, ["list"] = new BuiltInCommandMetadata { Command = ListCommand.Run, // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-list-reference - DocLink = new Uri("https://aka.ms/dotnet-list") + DocLink = "https://aka.ms/dotnet-list" }, ["migrate"] = new BuiltInCommandMetadata { Command = MigrateCommand.Run, // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-migrate - DocLink = new Uri("http://aka.ms/dotnet-migrate") + DocLink = "http://aka.ms/dotnet-migrate" }, ["msbuild"] = new BuiltInCommandMetadata { Command = MSBuildCommand.Run, // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-msbuild - DocLink = new Uri("https://aka.ms/dotnet-msbuild") + DocLink = "https://aka.ms/dotnet-msbuild" }, ["new"] = new BuiltInCommandMetadata { Command = NewCommandShim.Run, // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-new - DocLink = new Uri("https://aka.ms/dotnet-new") + DocLink = "https://aka.ms/dotnet-new" }, ["nuget"] = new BuiltInCommandMetadata { Command = NuGetCommand.Run, // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-nuget-locals - DocLink = new Uri("https://aka.ms/dotnet-nuget") + DocLink = "https://aka.ms/dotnet-nuget" }, ["pack"] = new BuiltInCommandMetadata { Command = PackCommand.Run, // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-pack - DocLink = new Uri("https://aka.ms/dotnet-pack") + DocLink = "https://aka.ms/dotnet-pack" }, ["publish"] = new BuiltInCommandMetadata { Command = PublishCommand.Run, // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-publish - DocLink = new Uri("https://aka.ms/dotnet-publish") + DocLink = "https://aka.ms/dotnet-publish" }, ["remove"] = new BuiltInCommandMetadata { Command = RemoveCommand.Run, // aka.ms link: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-remove-reference - DocLink = new Uri("https://aka.ms/dotnet-remove") + DocLink = "https://aka.ms/dotnet-remove" }, ["restore"] = new BuiltInCommandMetadata { Command = RestoreCommand.Run, // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-restore - DocLink = new Uri("https://aka.ms/dotnet-restore") + DocLink = "https://aka.ms/dotnet-restore" }, ["run"] = new BuiltInCommandMetadata { Command = RunCommand.Run, // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-run - DocLink = new Uri("https://aka.ms/dotnet-run") + DocLink = "https://aka.ms/dotnet-run" }, ["sln"] = new BuiltInCommandMetadata { Command = SlnCommand.Run, // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-sln - DocLink = new Uri("https://aka.ms/dotnet-sln") + DocLink = "https://aka.ms/dotnet-sln" }, ["test"] = new BuiltInCommandMetadata { Command = TestCommand.Run, // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-test - DocLink = new Uri("https://aka.ms/dotnet-test") + DocLink = "https://aka.ms/dotnet-test" }, ["vstest"] = new BuiltInCommandMetadata { Command = VSTestCommand.Run, // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-vstest - DocLink = new Uri("https://aka.ms/dotnet-vstest") + DocLink = "https://aka.ms/dotnet-vstest" } }; diff --git a/src/dotnet/commands/dotnet-help/HelpCommand.cs b/src/dotnet/commands/dotnet-help/HelpCommand.cs index cc0afe797..7c12ac37d 100644 --- a/src/dotnet/commands/dotnet-help/HelpCommand.cs +++ b/src/dotnet/commands/dotnet-help/HelpCommand.cs @@ -7,6 +7,7 @@ using System.Reflection; using System.Runtime.InteropServices; using Microsoft.DotNet.Cli.CommandLine; using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.Cli; namespace Microsoft.DotNet.Tools.Help { @@ -63,17 +64,17 @@ Project modification commands: app.OnExecute(() => { - Cli.BuiltInCommandMetadata builtIn; - if (Cli.BuiltInCommandsCatalog.Commands.TryGetValue(commandNameArgument.Value, out builtIn)) + BuiltInCommandMetadata builtIn; + if (BuiltInCommandsCatalog.Commands.TryGetValue(commandNameArgument.Value, out builtIn)) { - // var p = Process.Start(GetProcessStartInfo(builtIn)); - var process = ConfigureProcess(builtIn.DocLink.ToString()); + var process = ConfigureProcess(builtIn.DocLink); process.Start(); process.WaitForExit(); } else { Reporter.Error.WriteLine(String.Format(LocalizableStrings.CommandDoesNotExist, commandNameArgument.Value)); + Reporter.Output.WriteLine(UsageText); return 1; } return 0; diff --git a/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs b/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs index ee049a5e7..162239d79 100644 --- a/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs +++ b/test/dotnet-help.Tests/GivenThatIWantToShowHelpForDotnetCommand.cs @@ -68,7 +68,7 @@ Advanced Commands: } [Fact] - public void WhenInvalidCommandIsPassedToDOtnetHelpItPrintsError() + public void WhenInvalidCommandIsPassedToDotnetHelpItPrintsError() { var cmd = new DotnetCommand() .ExecuteWithCapturedOutput("help invalid");