Skip to content

Commit 0521f2d

Browse files
committed
github: list accounts in GitHub account selection tracing
1 parent 2f88662 commit 0521f2d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/shared/GitHub/GitHubHostProvider.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Linq;
34
using System.Net.Http;
45
using System.Threading.Tasks;
56
using GitHub.Diagnostics;
@@ -137,15 +138,21 @@ public async Task<ICredential> GetCredentialAsync(InputArguments input)
137138
if (string.IsNullOrWhiteSpace(userName))
138139
{
139140
IList<string> accounts = _context.CredentialStore.GetAccounts(service);
140-
_context.Trace.WriteLine($"Found {accounts.Count} accounts in the store for service={service}.");
141+
_context.Trace.WriteLine($"Found {accounts.Count} accounts in the store for service={service}{(accounts.Count > 0 ? ":" : ".")}");
142+
foreach (string account in accounts)
143+
{
144+
_context.Trace.WriteLine($" {account}");
145+
}
141146

142147
switch (accounts.Count)
143148
{
144149
case 1:
150+
_context.Trace.WriteLine("Only one account available - using that one!");
145151
userName = accounts[0];
146152
break;
147153

148154
case > 1:
155+
_context.Trace.WriteLine("Multiple accounts available - prompting user to select one...");
149156
userName = await _gitHubAuth.SelectAccountAsync(remoteUri, accounts);
150157
addAccount = userName is null;
151158
break;

0 commit comments

Comments
 (0)