using System; using System.CommandLine; using UpToolLib; using UpToolLib.Tool; namespace UpToolCLI { public static class Program { public static readonly UtLibFunctions Functions = new UtLibFunctions(); public static bool Basic; public static int Main(string[] args) { MutexLock.Lock(); try { Basic = args.Length > 0 && args[0].ToLower() == "--basic"; ExternalFunctionalityManager.Init(Functions); XmlTool.FixXml(); RootCommand rootCommand = new RootCommand(); rootCommand.AddGlobalOption(new Option("--basic", "Use only basic console functionality. Must be the first parameter in the call")); 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(); } } } }