Changing --version in the CLI
`dotnet --version` returns just the version number. This helps tools get this information without having to parse the full info. Introduce a new argument `--info` that returns the current "long form". With this, we also change the long form to say "RID" instead of "Runtime ID" simply because that would avoid any future localization issues and thus make the parsing easier. Fix #1607 #1882
This commit is contained in:
parent
f0fd9ae901
commit
c560e9af3c
4 changed files with 41 additions and 7 deletions
|
@ -61,7 +61,12 @@ namespace Microsoft.DotNet.Cli
|
|||
}
|
||||
else if (IsArg(args[lastArg], "version"))
|
||||
{
|
||||
PrintVersionInfo();
|
||||
PrintVersion();
|
||||
return 0;
|
||||
}
|
||||
else if (IsArg(args[lastArg], "info"))
|
||||
{
|
||||
PrintInfo();
|
||||
return 0;
|
||||
}
|
||||
else if (IsArg(args[lastArg], "h", "help"))
|
||||
|
@ -129,7 +134,12 @@ namespace Microsoft.DotNet.Cli
|
|||
.ExitCode;
|
||||
}
|
||||
|
||||
private static void PrintVersionInfo()
|
||||
private static void PrintVersion()
|
||||
{
|
||||
Reporter.Output.WriteLine(HelpCommand.ProductVersion);
|
||||
}
|
||||
|
||||
private static void PrintInfo()
|
||||
{
|
||||
HelpCommand.PrintVersionHeader();
|
||||
|
||||
|
@ -144,7 +154,7 @@ namespace Microsoft.DotNet.Cli
|
|||
Reporter.Output.WriteLine($" OS Name: {runtimeEnvironment.OperatingSystem}");
|
||||
Reporter.Output.WriteLine($" OS Version: {runtimeEnvironment.OperatingSystemVersion}");
|
||||
Reporter.Output.WriteLine($" OS Platform: {runtimeEnvironment.OperatingSystemPlatform}");
|
||||
Reporter.Output.WriteLine($" Runtime Id: {runtimeEnvironment.GetRuntimeIdentifier()}");
|
||||
Reporter.Output.WriteLine($" RID: {runtimeEnvironment.GetRuntimeIdentifier()}");
|
||||
}
|
||||
|
||||
private static bool IsArg(string candidate, string longName)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue