Correct the type for --waitForExit in Start (UpToolCLI)

This commit is contained in:
JFronny 2020-08-31 21:12:00 +02:00
parent 14b2643cbf
commit ddbfb39e87
3 changed files with 60 additions and 41 deletions

View File

@ -13,12 +13,14 @@ namespace Installer
{
public static class Program
{
public static bool Basic;
public static int Main(string[] args)
{
Thread.Sleep(2000);
MutexLock.Lock();
try
{
Basic = args.Length > 0 && args[0].ToLower() == "--basic";
ExternalFunctionalityManager.Init(new UtLibFunctions());
RootCommand rootCommand = new RootCommand();
Command install = new Command("install", "Install UpTool")

View File

@ -5,6 +5,7 @@ using System.Threading;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
using UpToolLib.DataStructures;
using static Installer.Program;
namespace Installer
{
@ -24,10 +25,13 @@ namespace Installer
finished = true;
};
client.DownloadProgressChanged += (sender, e) =>
{
if (!Basic)
{
Console.Write(
$"{new string('=', e.ProgressPercentage / 10)}[{e.ProgressPercentage}]{new string('-', 10 - e.ProgressPercentage / 10)}");
Console.CursorLeft = 0;
}
};
client.DownloadDataAsync(link);
while (!finished)
@ -46,6 +50,14 @@ namespace Installer
}
public bool YesNoDialog(string text, bool defaultVal)
{
if (Basic)
{
Console.WriteLine(text);
Console.WriteLine($"Selecting: {defaultVal}");
return defaultVal;
}
else
{
bool choosing = true;
bool current = defaultVal;
@ -81,8 +93,13 @@ namespace Installer
Console.WriteLine($" Selecting: {current}");
return current;
}
}
public void OkDialog(string text)
{
if (Basic)
Console.WriteLine(text);
else
{
Console.WriteLine(text);
Console.BackgroundColor = ConsoleColor.White;
@ -90,11 +107,11 @@ namespace Installer
Console.ResetColor();
Console.ReadKey();
}
}
public object GetDefaultIcon() => 0;
public object ImageFromB64(string b64) => 0;
public void Log(string text) => Console.WriteLine(text);
}
}

View File

@ -28,7 +28,7 @@ namespace UpToolCLI
Command start = new Command("start", "Starts an app")
{
new Argument<string>("identifier", "Something to identify the app"),
new Option<string>(new[] {"--waitForExit", "-wait"}, "Waits until the program quits")
new Option<bool>(new[] {"--waitForExit", "-wait"}, "Waits until the program quits")
};
start.Handler = CommandHandler.Create<string, bool>(Start);
rootCommand.AddCommand(start);