Skip to content

Commit

Permalink
Add framework type to cli variants
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeliux committed Aug 25, 2024
1 parent bd49d2f commit a04f78a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
4 changes: 3 additions & 1 deletion cli/Kryptor.Cli.Legacy/Variant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ public partial class CliContext
{
public string Variant => "Legacy";

public string Framework =>
public string FrameworkType => "Framework";

public string FrameworkVersion =>
#if NET462
"4.6.2"
#elif NET472
Expand Down
4 changes: 3 additions & 1 deletion cli/Kryptor.Cli.Native/Variant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ public partial class CliContext
{
public string Variant => "Native AOT";

public string Framework =>
public string FrameworkType => "Core";

public string FrameworkVersion =>
#if NET8_0
"8.0"
#endif
Expand Down
26 changes: 24 additions & 2 deletions cli/Kryptor.Cli.Shared/Program.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.CommandLine;
using System.CommandLine.Parsing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;

using Newtonsoft.Json.Linq;

using SAPTeam.Kryptor.Client;

namespace SAPTeam.Kryptor.Cli
{
public class Program
Expand All @@ -21,9 +25,27 @@ public static int Main(string[] args)

private static int Parse(string[] args)
{
RootCommand root = new RootCommand("Kryptor Command-Line Interface");
var verInfo = new Option<bool>("--full-version", "Show full version informations");

RootCommand root = new RootCommand("Kryptor Command-Line Interface")
{
verInfo
};

GlobalOptionsBinder globalOptionsBinder = GetGlobalOptions(root);

root.SetHandler((globalOptionsT, verInfoT) =>
{
if (verInfoT)
{
Console.WriteLine($"{Assembly.GetAssembly(typeof(Program)).GetCustomAttribute<AssemblyTitleAttribute>().Title} {Context.Variant} for .NET {Context.FrameworkType} {Context.FrameworkVersion}");
Console.WriteLine($"Application Version: {Assembly.GetAssembly(typeof(Program)).GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion}");
Console.WriteLine($"Kryptor Client Utility Version: {Assembly.GetAssembly(typeof(Utilities)).GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion}");
Console.WriteLine($"Kryptor Engine Version: {Assembly.GetAssembly(typeof(Kes)).GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion}");
Console.WriteLine($"KES API Version: {Kes.Version}");
}
}, globalOptionsBinder, verInfo);

#region Common Data Processing Options
Option<int> blockSize = new Option<int>("--block-size", () => Kes.DefaultBlockSize, "Determines the block size for data processing");
blockSize.AddAlias("-b");
Expand Down
4 changes: 3 additions & 1 deletion cli/Kryptor.Cli/Variant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ public partial class CliContext
{
public string Variant => "Standard";

public string Framework =>
public string FrameworkType => "Core";

public string FrameworkVersion =>
#if NET6_0
"6.0"
#elif NET8_0
Expand Down

0 comments on commit a04f78a

Please sign in to comment.