This repository has been archived on 2022-08-05. You can view files and clone it, but cannot push or open issues or pull requests.
UpTool2/UpToolCLI/Program.cs
JFronny 0eccafa9ea Various CLI improvements
- Show dialog before adding default repo
- Prevent edge-case where --basic is used later in a CLI command
- Fix RemoveRepo in basic mode
- Use default instead of true in basic YesNoDialog
2020-08-31 20:22:37 +02:00

43 lines
1.2 KiB
C#

using System;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.Linq;
using UpToolLib;
using UpToolLib.Tool;
namespace UpToolCLI
{
public static class Program
{
public static readonly UtLibFunctions Functions = new UtLibFunctions();
public static int Main(string[] args)
{
MutexLock.Lock();
try
{
ExternalFunctionalityManager.Init(Functions);
XmlTool.FixXml();
RootCommand rootCommand = new RootCommand();
rootCommand.AddGlobalOption(new Option<bool>("--basic"));
UtLibFunctions.Basic = args.Length > 0 && args[0] == "--basic";
PackageManagement.RegisterCommands(rootCommand);
CacheManagement.RegisterCommands(rootCommand);
ReposManagement.RegisterCommands(rootCommand);
Other.RegisterCommands(rootCommand);
return rootCommand.InvokeAsync(args).Result;
}
catch (Exception e)
{
Console.WriteLine($"FAILED: {e}");
return 1;
}
finally
{
MutexLock.Unlock();
}
}
}
}