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

43 lines
1.2 KiB
C#
Raw Normal View History

2020-03-24 20:53:23 +01:00
using System;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.Linq;
2020-03-24 20:53:23 +01:00
using UpToolLib;
using UpToolLib.Tool;
namespace UpToolCLI
{
public static class Program
2020-03-24 20:53:23 +01:00
{
2020-05-16 18:19:43 +02:00
public static readonly UtLibFunctions Functions = new UtLibFunctions();
2020-03-24 20:53:23 +01:00
public static int Main(string[] args)
{
2020-03-24 22:43:48 +01:00
MutexLock.Lock();
try
2020-03-24 20:53:23 +01:00
{
2020-04-08 18:03:50 +02:00
ExternalFunctionalityManager.Init(Functions);
XmlTool.FixXml();
2020-03-24 22:43:48 +01:00
RootCommand rootCommand = new RootCommand();
rootCommand.AddGlobalOption(new Option<bool>("--basic"));
UtLibFunctions.Basic = args.Length > 0 && args[0] == "--basic";
2020-05-16 18:19:43 +02:00
2020-05-16 17:59:44 +02:00
PackageManagement.RegisterCommands(rootCommand);
CacheManagement.RegisterCommands(rootCommand);
ReposManagement.RegisterCommands(rootCommand);
Other.RegisterCommands(rootCommand);
2020-05-16 18:19:43 +02:00
2020-03-24 22:43:48 +01:00
return rootCommand.InvokeAsync(args).Result;
}
2020-04-09 13:58:06 +02:00
catch (Exception e)
{
Console.WriteLine($"FAILED: {e}");
return 1;
}
2020-03-24 22:43:48 +01:00
finally
2020-03-24 20:53:23 +01:00
{
2020-03-24 22:43:48 +01:00
MutexLock.Unlock();
}
2020-03-24 20:53:23 +01:00
}
}
}