Files
minecraft-modpack-updater/ModpackUpdater.Apps.Client/Options.cs

45 lines
2.1 KiB
C#

using Mono.Options;
namespace ModpackUpdater.Apps.Client;
internal class Options
{
private readonly List<string> additionals = [];
private readonly OptionSet options;
public IReadOnlyList<string> Additionals => additionals;
public bool Help { get; private set; }
public bool Silent { get; private set; }
public bool NoUi { get; private set; }
public string RefTag { get; private set; }
public string Version { get; private set; }
public UpdateCheckOptionsAdv UpdateOptions { get; } = new();
public Options(string[] args)
{
options = new OptionSet
{
{ "silent", "Do not output anything.", s => Silent = true },
{ "h|help", "Writes the help text as output.", h => Help = true },
{ "n|noui", "Install without user interface.", n => NoUi = true },
{ "p|profile=", "Sets the minecraft profile folder.", p => UpdateOptions.ProfileFolder = p },
{ "c|config=", "Sets the modpack update info url.", c => UpdateOptions.ModpackConfig = c },
{ "s|side=", "Sets the installation side.\nDefault side is Client.\nAvailable: Client, Server", s => UpdateOptions.Side = Enum.Parse<Side>(s)},
{ "u|uai", "Disallow an update directly after install. This only has effect if there is no existing installation.", uai => UpdateOptions.AllowUpdaterAfterInstall = false},
{ "noupdate", "Skip the update check.", noupdate => UpdateOptions.NoUpdate = true},
{ "m|maintenance", "Ignores the maintenance mode.", m => UpdateOptions.IgnoreMaintenance = true},
{ "i|nonpublic", "Include non public (currently hidden) updates.", i => UpdateOptions.IncludeNonPublic = true},
{ "k|key=", "An key for retriving extra files on updates.", k => UpdateOptions.ExtrasKey = k},
{ "r|reftag=", "Force uses a specific reference tag, if supported.", r => RefTag = r},
{ "v|version=", "Force uses a specific version, if supported.", v => Version = v},
};
additionals.AddRange(options.Parse(args));
}
public void DrawHelp()
{
options.WriteOptionDescriptions(Console.Out);
}
}