-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add version output to code generator (#904)
* Added version information on code generation * Fixed warnings * Fixed comments
- Loading branch information
1 parent
6fc1af2
commit 8382bd0
Showing
3 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/HassModel/NetDaemon.HassModel.CodeGenerator/Helpers/VersionHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Reflection; | ||
|
||
namespace NetDaemon.HassModel.CodeGenerator.Helpers; | ||
|
||
#pragma warning disable CA1303 | ||
|
||
/// <summary> | ||
/// Helper class for managing NetDaemon version tasks | ||
/// </summary> | ||
public static class VersionHelper | ||
{ | ||
/// <summary> | ||
/// Returns current version of NetDaemon | ||
/// </summary> | ||
public static string GeneratorVersion { get; } = | ||
Assembly.GetAssembly(typeof(Generator))!.GetName().Version!.ToString(); | ||
|
||
/// <summary> | ||
/// Pretty prints version information to console | ||
/// </summary> | ||
public static void PrintVersion() | ||
{ | ||
Console.Write("Codegen version: "); | ||
Console.ForegroundColor = ConsoleColor.Green; | ||
Console.WriteLine(GeneratorVersion); | ||
Console.ResetColor(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters