mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add logging and UI enhancements for read-only and writable media images options
This commit is contained in:
@@ -39,6 +39,7 @@ using Aaru.Console;
|
||||
using Aaru.Core;
|
||||
using Aaru.Localization;
|
||||
using JetBrains.Annotations;
|
||||
using Serilog;
|
||||
using Spectre.Console;
|
||||
using Spectre.Console.Cli;
|
||||
|
||||
@@ -60,6 +61,7 @@ sealed class ListOptionsCommand : Command<ListOptionsCommand.Settings>
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
|
||||
AaruConsole.WriteLine(UI.Read_only_filesystems_options);
|
||||
Log.Information(UI.Read_only_filesystems_options);
|
||||
|
||||
foreach(IReadOnlyFilesystem fs in plugins.ReadOnlyFilesystems.Values)
|
||||
{
|
||||
@@ -71,18 +73,26 @@ sealed class ListOptionsCommand : Command<ListOptionsCommand.Settings>
|
||||
|
||||
var table = new Table
|
||||
{
|
||||
Title = new TableTitle(string.Format(UI.Options_for_0, fs.Name))
|
||||
Title = new TableTitle(string.Format($"[bold][blue]{UI.Options_for_0}[/][/]",
|
||||
$"[italic][teal]{fs.Name}[/][/]"))
|
||||
};
|
||||
|
||||
table.AddColumn(UI.Title_Name);
|
||||
table.AddColumn(UI.Title_Type);
|
||||
table.AddColumn(UI.Title_Description);
|
||||
table.AddColumn(new TableColumn(new Markup($"[bold][purple]{UI.Title_Name}[/][/]").Centered()));
|
||||
table.AddColumn(new TableColumn(new Markup($"[bold][olive]{UI.Title_Type}[/][/]").Centered()));
|
||||
table.AddColumn(new TableColumn(new Markup($"[bold][slateblue1]{UI.Title_Description}[/][/]").Centered()));
|
||||
table.Border(TableBorder.Rounded);
|
||||
table.BorderColor(Color.Yellow);
|
||||
|
||||
foreach((string name, Type type, string description) option in options.OrderBy(t => t.name))
|
||||
{
|
||||
table.AddRow(Markup.Escape(option.name),
|
||||
$"[italic]{TypeToString(option.type)}[/]",
|
||||
Markup.Escape(option.description));
|
||||
table.AddRow($"[purple]{Markup.Escape(option.name)}[/]",
|
||||
$"[italic][olive]{TypeToString(option.type)}[/][/]",
|
||||
$"[slateblue1]{Markup.Escape(option.description)}[/]");
|
||||
|
||||
Log.Information("({Name}) - {Type} - {Description}",
|
||||
option.name,
|
||||
TypeToString(option.type),
|
||||
option.description);
|
||||
}
|
||||
|
||||
AnsiConsole.Write(table);
|
||||
|
||||
@@ -39,6 +39,7 @@ using Aaru.Console;
|
||||
using Aaru.Core;
|
||||
using Aaru.Localization;
|
||||
using JetBrains.Annotations;
|
||||
using Serilog;
|
||||
using Spectre.Console;
|
||||
using Spectre.Console.Cli;
|
||||
|
||||
@@ -60,8 +61,9 @@ sealed class ListOptionsCommand : Command<ListOptionsCommand.Settings>
|
||||
PluginRegister plugins = PluginRegister.Singleton;
|
||||
|
||||
AaruConsole.WriteLine(UI.Read_Write_media_images_options);
|
||||
Log.Information(UI.Read_Write_media_images_options);
|
||||
|
||||
foreach(IBaseWritableImage plugin in plugins.WritableImages.Values)
|
||||
foreach(IWritableImage plugin in plugins.WritableImages.Values)
|
||||
{
|
||||
if(plugin is null) continue;
|
||||
|
||||
@@ -71,21 +73,30 @@ sealed class ListOptionsCommand : Command<ListOptionsCommand.Settings>
|
||||
|
||||
var table = new Table
|
||||
{
|
||||
Title = new TableTitle(string.Format(UI.Options_for_0, plugin.Name))
|
||||
Title = new TableTitle(string.Format($"[bold][blue]{UI.Options_for_0}[/][/]",
|
||||
$"[italic][teal]{plugin.Name}[/][/]"))
|
||||
};
|
||||
|
||||
table.AddColumn(UI.Title_Name);
|
||||
table.AddColumn(UI.Title_Type);
|
||||
table.AddColumn(UI.Default);
|
||||
table.AddColumn(UI.Title_Description);
|
||||
table.AddColumn(new TableColumn(new Markup($"[bold][purple]{UI.Title_Name}[/][/]").Centered()));
|
||||
table.AddColumn(new TableColumn(new Markup($"[bold][olive]{UI.Title_Type}[/][/]").Centered()));
|
||||
table.AddColumn(new TableColumn(new Markup($"[bold][aqua]{UI.Default}[/][/]").Centered()));
|
||||
table.AddColumn(new TableColumn(new Markup($"[bold][slateblue1]{UI.Title_Description}[/][/]").Centered()));
|
||||
table.Border(TableBorder.Rounded);
|
||||
table.BorderColor(Color.Yellow);
|
||||
|
||||
foreach((string name, Type type, string description, object @default) option in
|
||||
options.OrderBy(t => t.name))
|
||||
{
|
||||
table.AddRow(Markup.Escape(option.name),
|
||||
table.AddRow($"[purple]{Markup.Escape(option.name)}[/]",
|
||||
$"[italic][olive]{TypeToString(option.type)}[/][/]",
|
||||
$"[italic][aqua]{option.@default?.ToString() ?? ""}[/][/]",
|
||||
$"[slateblue1]{Markup.Escape(option.description)}[/]");
|
||||
|
||||
Log.Information("({Name}) - {Type} - {Default} - {Description}",
|
||||
option.name,
|
||||
TypeToString(option.type),
|
||||
option.@default?.ToString() ?? "",
|
||||
Markup.Escape(option.description));
|
||||
option.description);
|
||||
}
|
||||
|
||||
AnsiConsole.Write(table);
|
||||
|
||||
Reference in New Issue
Block a user