public static int Main(string[] args)
{
try
{
var command = args.FirstOrDefault()?.ToLower() ?? "default";
var method = CommandMethods
.SingleOrDefault(m => string.Equals(m.Name, command, StringComparison.CurrentCultureIgnoreCase));
if (method == null)
{
if (command == "help")
DefaultHelp();
else
throw new Exception("Unknown command: " + command);
return Failure;
}
method.Invoke(new Commands(), Parameters(method, args.Skip(1).ToArray()));
using (Foreground.Green)
{
WriteLine();
WriteLine("Build Succeeded!");
}
return Success;
}
catch (Exception exception)
{
using (Foreground.DarkRed)
{
WriteLine();
WriteLine(exception.Message);
WriteLine();
WriteLine("Build Failed!");
}
return Failure;
}
}