2022-03-30 03:39:48 +00:00
|
|
|
using System;
|
|
|
|
using System.CommandLine;
|
|
|
|
using System.CommandLine.Invocation;
|
2022-09-29 05:10:49 +00:00
|
|
|
using System.CommandLine.NamingConventionBinder;
|
2022-03-30 03:39:48 +00:00
|
|
|
using System.Linq;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using FluentFTP.Helpers;
|
|
|
|
using Microsoft.Extensions.Logging;
|
2022-10-14 22:08:21 +00:00
|
|
|
using Wabbajack.CLI.Builder;
|
2022-03-30 03:39:48 +00:00
|
|
|
using Wabbajack.DTOs;
|
|
|
|
using Wabbajack.Networking.WabbajackClientApi;
|
|
|
|
|
|
|
|
namespace Wabbajack.CLI.Verbs;
|
|
|
|
|
2022-10-14 22:08:21 +00:00
|
|
|
public class ListModlists
|
2022-03-30 03:39:48 +00:00
|
|
|
{
|
|
|
|
private readonly ILogger<ListCreationClubContent> _logger;
|
|
|
|
private readonly Client _client;
|
|
|
|
|
|
|
|
public ListModlists(ILogger<ListCreationClubContent> logger, Client wjClient)
|
|
|
|
{
|
|
|
|
_logger = logger;
|
|
|
|
_client = wjClient;
|
|
|
|
}
|
2022-10-01 01:35:36 +00:00
|
|
|
|
|
|
|
public static VerbDefinition Definition =
|
|
|
|
new("list-modlists", "Lists all known modlists", Array.Empty<OptionDefinition>());
|
2022-03-30 03:39:48 +00:00
|
|
|
|
|
|
|
public async Task<int> Run(CancellationToken token)
|
|
|
|
{
|
|
|
|
_logger.LogInformation("Loading all modlist definitions");
|
|
|
|
var modlists = await _client.LoadLists();
|
|
|
|
_logger.LogInformation("Loaded {Count} lists", modlists.Length);
|
|
|
|
|
|
|
|
foreach (var modlist in modlists.OrderBy(l => l.NamespacedName))
|
|
|
|
{
|
|
|
|
_logger.LogInformation("{Url} {Game} {Size}", modlist.NamespacedName, modlist.Game.MetaData().HumanFriendlyGameName, modlist.DownloadMetadata!.Size.FileSizeToString());
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|