Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Displaying the lambda tools version for the help command #117

Merged
merged 2 commits into from
May 12, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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