4 Commits

Author SHA1 Message Date
deeee34f87 v1.5.2.2 2024-08-10 09:27:13 +02:00
f254ac03e1 draw help always even if not noui is set 2024-08-10 09:27:09 +02:00
c9650c6118 v1.5.2.1 2024-08-10 09:24:07 +02:00
2e467c0a96 draw help 2024-08-10 09:23:57 +02:00
3 changed files with 13 additions and 3 deletions

View File

@@ -8,7 +8,7 @@
<AssemblyName>Minecraft Modpack Updater</AssemblyName> <AssemblyName>Minecraft Modpack Updater</AssemblyName>
<ImplicitUsings>true</ImplicitUsings> <ImplicitUsings>true</ImplicitUsings>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract> <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<Version>1.5.2.0</Version> <Version>1.5.2.2</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -6,17 +6,20 @@ namespace ModpackUpdater;
internal class Options internal class Options
{ {
private readonly List<string> additionals = []; private readonly List<string> additionals = [];
private readonly OptionSet options;
public IReadOnlyList<string> Additionals => additionals; public IReadOnlyList<string> Additionals => additionals;
public bool Help { get; private set; }
public bool Silent { get; private set; } public bool Silent { get; private set; }
public bool NoUi { get; private set; } public bool NoUi { get; private set; }
public UpdateCheckOptionsAdv UpdateOptions { get; } = new(); public UpdateCheckOptionsAdv UpdateOptions { get; } = new();
public Options(string[] args) public Options(string[] args)
{ {
var options = new OptionSet options = new OptionSet
{ {
{ "silent", "Do not output anything.", s => Silent = s != null }, { "silent", "Do not output anything.", s => Silent = s != null },
{ "h|help", "Writes the help text as output.", h => Help = h != null },
{ "n|noui", "Install without user interface.", n => NoUi = n != null }, { "n|noui", "Install without user interface.", n => NoUi = n != null },
{ "p|profile=", "Sets the minecraft profile folder.", p => UpdateOptions.ProfileFolder = p }, { "p|profile=", "Sets the minecraft profile folder.", p => UpdateOptions.ProfileFolder = p },
{ "c|config=", "Sets the minecraft profile folder.", c => UpdateOptions.ModpackConfig = c }, { "c|config=", "Sets the minecraft profile folder.", c => UpdateOptions.ModpackConfig = c },
@@ -29,4 +32,9 @@ internal class Options
additionals.AddRange(options.Parse(args)); additionals.AddRange(options.Parse(args));
} }
public void DrawHelp()
{
options.WriteOptionDescriptions(Console.Out);
}
} }

View File

@@ -29,7 +29,9 @@ public static class Program
internal static void Main(string[] args) internal static void Main(string[] args)
{ {
var options = new Options(args); var options = new Options(args);
if (options.NoUi) if (options.Help)
options.DrawHelp();
else if (options.NoUi)
InstallWithoutGui(options.UpdateOptions, options.Silent); InstallWithoutGui(options.UpdateOptions, options.Silent);
else else
{ {