Skip to content

Commit

Permalink
Merge pull request #367 from asherber/getversion
Browse files Browse the repository at this point in the history
Make get-version -v friendlier
  • Loading branch information
AArnott authored Jul 24, 2019
2 parents 9880338 + d12fda4 commit 4263dc9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/nbgv/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace Nerdbank.GitVersioning.Tool
using System.CommandLine;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
Expand All @@ -25,6 +26,8 @@ internal class Program

private const string DefaultRef = "HEAD";

private const BindingFlags CaseInsensitiveFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.IgnoreCase;

private enum ExitCodes
{
OK,
Expand Down Expand Up @@ -293,8 +296,8 @@ private static ExitCodes OnGetVersionCommand(string projectPath, string format,
Console.WriteLine("Version: {0}", oracle.Version);
Console.WriteLine("AssemblyVersion: {0}", oracle.AssemblyVersion);
Console.WriteLine("AssemblyInformationalVersion: {0}", oracle.AssemblyInformationalVersion);
Console.WriteLine("NuGet package Version: {0}", oracle.NuGetPackageVersion);
Console.WriteLine("NPM package Version: {0}", oracle.NpmPackageVersion);
Console.WriteLine("NuGetPackageVersion: {0}", oracle.NuGetPackageVersion);
Console.WriteLine("NpmPackageVersion: {0}", oracle.NpmPackageVersion);
break;
case "json":
var converters = new JsonConverter[]
Expand All @@ -316,7 +319,7 @@ private static ExitCodes OnGetVersionCommand(string projectPath, string format,
return ExitCodes.UnsupportedFormat;
}

var property = oracle.GetType().GetProperty(singleVariable);
var property = oracle.GetType().GetProperty(singleVariable, CaseInsensitiveFlags);
if (property == null)
{
Console.Error.WriteLine("Variable \"{0}\" not a version property.", singleVariable);
Expand Down

0 comments on commit 4263dc9

Please sign in to comment.