Responding to PR feedback
This commit is contained in:
parent
36e3d5d2f9
commit
d251734170
4 changed files with 25 additions and 24 deletions
|
@ -5,6 +5,6 @@ namespace Microsoft.DotNet.Cli
|
||||||
public class BuiltInCommandMetadata
|
public class BuiltInCommandMetadata
|
||||||
{
|
{
|
||||||
public Func<string[], int> Command { get; set; }
|
public Func<string[], int> Command { get; set; }
|
||||||
public Uri DocLink { get; set; }
|
public string DocLink { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -29,110 +29,110 @@ namespace Microsoft.DotNet.Cli
|
||||||
{
|
{
|
||||||
Command = AddCommand.Run,
|
Command = AddCommand.Run,
|
||||||
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-add-reference
|
// 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
|
["build"] = new BuiltInCommandMetadata
|
||||||
{
|
{
|
||||||
Command = BuildCommand.Run,
|
Command = BuildCommand.Run,
|
||||||
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-build
|
// 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
|
["cache"] = new BuiltInCommandMetadata
|
||||||
{
|
{
|
||||||
Command = CacheCommand.Run,
|
Command = CacheCommand.Run,
|
||||||
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-cache
|
// 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
|
["clean"] = new BuiltInCommandMetadata
|
||||||
{
|
{
|
||||||
Command = CleanCommand.Run,
|
Command = CleanCommand.Run,
|
||||||
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-clean
|
// 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
|
["help"] = new BuiltInCommandMetadata
|
||||||
{
|
{
|
||||||
Command = HelpCommand.Run,
|
Command = HelpCommand.Run,
|
||||||
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-help
|
// 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
|
["list"] = new BuiltInCommandMetadata
|
||||||
{
|
{
|
||||||
Command = ListCommand.Run,
|
Command = ListCommand.Run,
|
||||||
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-list-reference
|
// 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
|
["migrate"] = new BuiltInCommandMetadata
|
||||||
{
|
{
|
||||||
Command = MigrateCommand.Run,
|
Command = MigrateCommand.Run,
|
||||||
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-migrate
|
// 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
|
["msbuild"] = new BuiltInCommandMetadata
|
||||||
{
|
{
|
||||||
Command = MSBuildCommand.Run,
|
Command = MSBuildCommand.Run,
|
||||||
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-msbuild
|
// 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
|
["new"] = new BuiltInCommandMetadata
|
||||||
{
|
{
|
||||||
Command = NewCommandShim.Run,
|
Command = NewCommandShim.Run,
|
||||||
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-new
|
// 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
|
["nuget"] = new BuiltInCommandMetadata
|
||||||
{
|
{
|
||||||
Command = NuGetCommand.Run,
|
Command = NuGetCommand.Run,
|
||||||
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-nuget-locals
|
// 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
|
["pack"] = new BuiltInCommandMetadata
|
||||||
{
|
{
|
||||||
Command = PackCommand.Run,
|
Command = PackCommand.Run,
|
||||||
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-pack
|
// 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
|
["publish"] = new BuiltInCommandMetadata
|
||||||
{
|
{
|
||||||
Command = PublishCommand.Run,
|
Command = PublishCommand.Run,
|
||||||
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-publish
|
// 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
|
["remove"] = new BuiltInCommandMetadata
|
||||||
{
|
{
|
||||||
Command = RemoveCommand.Run,
|
Command = RemoveCommand.Run,
|
||||||
// aka.ms link: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-remove-reference
|
// 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
|
["restore"] = new BuiltInCommandMetadata
|
||||||
{
|
{
|
||||||
Command = RestoreCommand.Run,
|
Command = RestoreCommand.Run,
|
||||||
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-restore
|
// 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
|
["run"] = new BuiltInCommandMetadata
|
||||||
{
|
{
|
||||||
Command = RunCommand.Run,
|
Command = RunCommand.Run,
|
||||||
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-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
|
["sln"] = new BuiltInCommandMetadata
|
||||||
{
|
{
|
||||||
Command = SlnCommand.Run,
|
Command = SlnCommand.Run,
|
||||||
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-sln
|
// 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
|
["test"] = new BuiltInCommandMetadata
|
||||||
{
|
{
|
||||||
Command = TestCommand.Run,
|
Command = TestCommand.Run,
|
||||||
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-test
|
// 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
|
["vstest"] = new BuiltInCommandMetadata
|
||||||
{
|
{
|
||||||
Command = VSTestCommand.Run,
|
Command = VSTestCommand.Run,
|
||||||
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-vstest
|
// 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"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using Microsoft.DotNet.Cli.CommandLine;
|
using Microsoft.DotNet.Cli.CommandLine;
|
||||||
using Microsoft.DotNet.Cli.Utils;
|
using Microsoft.DotNet.Cli.Utils;
|
||||||
|
using Microsoft.DotNet.Cli;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Tools.Help
|
namespace Microsoft.DotNet.Tools.Help
|
||||||
{
|
{
|
||||||
|
@ -63,17 +64,17 @@ Project modification commands:
|
||||||
|
|
||||||
app.OnExecute(() =>
|
app.OnExecute(() =>
|
||||||
{
|
{
|
||||||
Cli.BuiltInCommandMetadata builtIn;
|
BuiltInCommandMetadata builtIn;
|
||||||
if (Cli.BuiltInCommandsCatalog.Commands.TryGetValue(commandNameArgument.Value, out builtIn))
|
if (BuiltInCommandsCatalog.Commands.TryGetValue(commandNameArgument.Value, out builtIn))
|
||||||
{
|
{
|
||||||
// var p = Process.Start(GetProcessStartInfo(builtIn));
|
var process = ConfigureProcess(builtIn.DocLink);
|
||||||
var process = ConfigureProcess(builtIn.DocLink.ToString());
|
|
||||||
process.Start();
|
process.Start();
|
||||||
process.WaitForExit();
|
process.WaitForExit();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Reporter.Error.WriteLine(String.Format(LocalizableStrings.CommandDoesNotExist, commandNameArgument.Value));
|
Reporter.Error.WriteLine(String.Format(LocalizableStrings.CommandDoesNotExist, commandNameArgument.Value));
|
||||||
|
Reporter.Output.WriteLine(UsageText);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -68,7 +68,7 @@ Advanced Commands:
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void WhenInvalidCommandIsPassedToDOtnetHelpItPrintsError()
|
public void WhenInvalidCommandIsPassedToDotnetHelpItPrintsError()
|
||||||
{
|
{
|
||||||
var cmd = new DotnetCommand()
|
var cmd = new DotnetCommand()
|
||||||
.ExecuteWithCapturedOutput("help invalid");
|
.ExecuteWithCapturedOutput("help invalid");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue