forked from git-ecosystem/git-credential-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
51 lines (47 loc) · 2.08 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using Atlassian.Bitbucket;
using GitHub;
using GitLab;
using Microsoft.AzureRepos;
using GitCredentialManager.Authentication;
namespace GitCredentialManager
{
public static class Program
{
public static void Main(string[] args)
{
string appPath = ApplicationBase.GetEntryApplicationPath();
using (var context = new CommandContext(appPath))
using (var app = new Application(context))
{
// Workaround for https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/issues/2560
if (MicrosoftAuthentication.CanUseBroker(context))
{
try
{
MicrosoftAuthentication.InitializeBroker();
}
catch (Exception ex)
{
context.Streams.Error.WriteLine(
"warning: broker initialization failed{0}{1}",
Environment.NewLine, ex.Message
);
}
}
// Register all supported host providers at the normal priority.
// The generic provider should never win against a more specific one, so register it with low priority.
app.RegisterProvider(new AzureReposHostProvider(context), HostProviderPriority.Normal);
app.RegisterProvider(new BitbucketHostProvider(context), HostProviderPriority.Normal);
app.RegisterProvider(new GitHubHostProvider(context), HostProviderPriority.Normal);
app.RegisterProvider(new GitLabHostProvider(context), HostProviderPriority.Normal);
app.RegisterProvider(new GenericHostProvider(context), HostProviderPriority.Low);
int exitCode = app.RunAsync(args)
.ConfigureAwait(false)
.GetAwaiter()
.GetResult();
Environment.Exit(exitCode);
}
}
}
}