draw help
This commit is contained in:
@@ -6,17 +6,20 @@ namespace ModpackUpdater;
|
||||
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 UpdateCheckOptionsAdv UpdateOptions { get; } = new();
|
||||
|
||||
public Options(string[] args)
|
||||
{
|
||||
var options = new OptionSet
|
||||
options = new OptionSet
|
||||
{
|
||||
{ "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 },
|
||||
{ "p|profile=", "Sets the minecraft profile folder.", p => UpdateOptions.ProfileFolder = p },
|
||||
{ "c|config=", "Sets the minecraft profile folder.", c => UpdateOptions.ModpackConfig = c },
|
||||
@@ -29,4 +32,9 @@ internal class Options
|
||||
|
||||
additionals.AddRange(options.Parse(args));
|
||||
}
|
||||
|
||||
public void DrawHelp()
|
||||
{
|
||||
options.WriteOptionDescriptions(Console.Out);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,12 @@ public static class Program
|
||||
{
|
||||
var options = new Options(args);
|
||||
if (options.NoUi)
|
||||
{
|
||||
if (options.Help)
|
||||
options.DrawHelp();
|
||||
else
|
||||
InstallWithoutGui(options.UpdateOptions, options.Silent);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowWindow(GetConsoleWindow(), 0);
|
||||
|
||||
Reference in New Issue
Block a user