From bfacf0b90fe3a1170e51a766026b6f6ea4f1c12d Mon Sep 17 00:00:00 2001 From: trawzified <55751269+tr4wzified@users.noreply.github.com> Date: Thu, 15 Aug 2024 19:12:53 +0200 Subject: [PATCH] Open modlist report in browser by default --- Wabbajack.CLI/Verbs/ModlistReport.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Wabbajack.CLI/Verbs/ModlistReport.cs b/Wabbajack.CLI/Verbs/ModlistReport.cs index 81e4e9f7..ee6d8270 100644 --- a/Wabbajack.CLI/Verbs/ModlistReport.cs +++ b/Wabbajack.CLI/Verbs/ModlistReport.cs @@ -35,7 +35,8 @@ public class ModlistReport public static VerbDefinition Definition = new("modlist-report", "Generates a usage report for a Modlist file", new[] { - new OptionDefinition(typeof(AbsolutePath), "i", "input", "Wabbajack file from which to generate a report") + new OptionDefinition(typeof(AbsolutePath), "i", "input", "Wabbajack file from which to generate a report"), + new OptionDefinition(typeof(bool), "b", "browser", "Open report in browser after generating it (default true)") }); private static async Task ReportTemplate(object o) @@ -45,10 +46,10 @@ public class ModlistReport return await func(o, CancellationToken.None); } - public async Task Run(AbsolutePath input) + public async Task Run(AbsolutePath input, bool browser = true) { - _logger.LogInformation("Loading Modlist"); + _logger.LogInformation("Loading modlist..."); var modlist = await StandardInstaller.LoadFromFile(_dtos, input); Dictionary patchSizes; @@ -104,8 +105,11 @@ public class ModlistReport WabbajackSize = input.Size().ToFileSizeString() }); - await input.WithExtension(Ext.Html).WriteAllTextAsync(data); - + var path = input.WithExtension(Ext.Html); + await path.WriteAllTextAsync(data); + _logger.LogInformation($"Exported modlist report to {path}"); + + if(browser) System.Diagnostics.Process.Start("explorer", path.ToString()); return 0; } } \ No newline at end of file