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

41 lines
1.2 KiB
C#

using System;
using System.CommandLine;
using UpToolLib;
namespace UpToolCLI
{
public static class Program
{
public static readonly UtLibFunctions Functions = new();
public static bool Basic;
public static UpToolLibMain Lib;
public static int Main(string[] args)
{
try
{
Basic = args.Length > 0 && args[0].ToLower() == "--basic";
Lib = new UpToolLibMain(Functions);
Lib.V1.XmlTool.FixXml();
RootCommand rootCommand = new();
rootCommand.AddGlobalOption(new Option<bool>("--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
{
Lib?.Dispose();
}
}
}
}