From b6b81267c780356c77f4883cd29e1ec228df0226 Mon Sep 17 00:00:00 2001 From: Jackson Isaac Date: Fri, 5 Oct 2018 00:41:27 +0530 Subject: [PATCH] Add version to console title (#48) --- src/Microsoft.Atlas.CommandLine/Program.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.Atlas.CommandLine/Program.cs b/src/Microsoft.Atlas.CommandLine/Program.cs index 1c4b796..07d041a 100644 --- a/src/Microsoft.Atlas.CommandLine/Program.cs +++ b/src/Microsoft.Atlas.CommandLine/Program.cs @@ -3,6 +3,7 @@ using System; using System.Linq; +using System.Reflection; using System.Runtime.InteropServices; using Microsoft.Atlas.CommandLine.Accounts; using Microsoft.Atlas.CommandLine.Blueprints; @@ -33,9 +34,13 @@ namespace Microsoft.Atlas.CommandLine Console.SetOut(secretTracker.FilterTextWriter(new ColorConsoleWriter(ColorConsole.GetOutput()))); Console.SetError(secretTracker.FilterTextWriter(new ColorConsoleWriter(ColorConsole.GetError()))); + var attributes = typeof(Program).GetTypeInfo().Assembly.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute)); + var assemblyVersionAttribute = attributes.SingleOrDefault() as AssemblyInformationalVersionAttribute; + var console = services.GetRequiredService(); - console.WriteLine("Atlas".Color(ConsoleColor.Cyan)); + var consoleTitle = $"Atlas version {assemblyVersionAttribute?.InformationalVersion}"; + console.WriteLine(consoleTitle.Color(ConsoleColor.Cyan)); var app = services.GetRequiredService();