mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add logging for list encodings command and enhance UI formatting
This commit is contained in:
6
Aaru.Localization/UI.Designer.cs
generated
6
Aaru.Localization/UI.Designer.cs
generated
@@ -6051,5 +6051,11 @@ namespace Aaru.Localization {
|
|||||||
return ResourceManager.GetString("Title_Archive_Format", resourceCulture);
|
return ResourceManager.GetString("Title_Archive_Format", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string List_encodings_command {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("List_encodings_command", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3102,4 +3102,7 @@ Do you want to continue?</value>
|
|||||||
<data name="Title_Archive_Format" xml:space="preserve">
|
<data name="Title_Archive_Format" xml:space="preserve">
|
||||||
<value>Archive format</value>
|
<value>Archive format</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="List_encodings_command" xml:space="preserve">
|
||||||
|
<value>List encodings</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -36,6 +36,7 @@ using Aaru.CommonTypes.Enums;
|
|||||||
using Aaru.Console;
|
using Aaru.Console;
|
||||||
using Aaru.Core;
|
using Aaru.Core;
|
||||||
using Aaru.Localization;
|
using Aaru.Localization;
|
||||||
|
using Serilog;
|
||||||
using Spectre.Console;
|
using Spectre.Console;
|
||||||
using Spectre.Console.Cli;
|
using Spectre.Console.Cli;
|
||||||
|
|
||||||
@@ -55,6 +56,8 @@ sealed class ListEncodingsCommand : Command<ListEncodingsCommand.Settings>
|
|||||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", settings.Debug);
|
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", settings.Debug);
|
||||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", settings.Verbose);
|
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", settings.Verbose);
|
||||||
|
|
||||||
|
Log.Information(UI.List_encodings_command);
|
||||||
|
|
||||||
var encodings = Encoding.GetEncodings()
|
var encodings = Encoding.GetEncodings()
|
||||||
.Select(info => new CommonEncodingInfo
|
.Select(info => new CommonEncodingInfo
|
||||||
{
|
{
|
||||||
@@ -71,11 +74,18 @@ sealed class ListEncodingsCommand : Command<ListEncodingsCommand.Settings>
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
Table table = new();
|
Table table = new();
|
||||||
table.AddColumn(UI.Title_Name);
|
table.AddColumn(new TableColumn(new Markup($"[bold][darkgreen]{UI.Title_Name}[/][/]").Centered()));
|
||||||
table.AddColumn(UI.Title_Description);
|
table.AddColumn(new TableColumn(new Markup($"[bold][slateblue1]{UI.Title_Description}[/][/]").Centered()));
|
||||||
|
table.Border(TableBorder.Rounded);
|
||||||
|
table.BorderColor(Color.Yellow);
|
||||||
|
|
||||||
foreach(CommonEncodingInfo info in encodings.OrderBy(t => t.DisplayName))
|
foreach(CommonEncodingInfo info in encodings.OrderBy(t => t.DisplayName))
|
||||||
table.AddRow(info.Name, info.DisplayName);
|
{
|
||||||
|
table.AddRow($"[italic][darkgreen]{Markup.Escape(info.Name)}[/][/]",
|
||||||
|
$"[italic][slateblue1]{Markup.Escape(info.DisplayName)}[/][/]");
|
||||||
|
|
||||||
|
Log.Information("({Name}) - {DisplayName}", info.Name, info.DisplayName);
|
||||||
|
}
|
||||||
|
|
||||||
AnsiConsole.Write(table);
|
AnsiConsole.Write(table);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user