Skip to content

Commit

Permalink
Merge pull request #117 from coreycoto/version
Browse files Browse the repository at this point in the history
Displaying the lambda tools version for the help command
  • Loading branch information
normj authored May 12, 2017
2 parents f1eb9b0 + dcbd4a1 commit 939f767
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions Libraries/src/Amazon.Lambda.Tools/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

using Amazon.Lambda.Tools.Commands;
using Amazon.Lambda.Tools.Options;
Expand All @@ -12,6 +12,23 @@ namespace Amazon.Lambda.Tools
{
public class Program
{
private static string Version
{
get
{
AssemblyInformationalVersionAttribute attribute = null;
try
{
attribute = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>();
}
catch (AmbiguousMatchException)
{
// Catch exception and continue if multiple attributes are found.
}
return attribute?.InformationalVersion;
}
}

public static void Main(string[] args)
{
try
Expand Down Expand Up @@ -98,7 +115,13 @@ public static void Main(string[] args)

private static void PrintUsageHeader()
{
Console.WriteLine("AWS Lambda Tools for .NET Core functions");
var sb = new StringBuilder("AWS Lambda Tools for .NET Core functions");
var version = Version;
if (!string.IsNullOrEmpty(version))
{
sb.Append($" ({version})");
}
Console.WriteLine(sb.ToString());
Console.WriteLine("Project Home: https://github.com/aws/aws-lambda-dotnet");
Console.WriteLine("\t");
}
Expand Down

0 comments on commit 939f767

Please sign in to comment.