fix: display full account name in list

Show the full names of the accounts of a list instead of their
account IDs
This commit is contained in:
Dan Anglin 2024-05-31 21:41:10 +01:00
parent bff1eba972
commit 5cf6116fe8
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638
2 changed files with 5 additions and 3 deletions

View file

@ -220,7 +220,7 @@ func (c *ShowExecutor) showList(gtsClient *client.Client) error {
if len(accounts) > 0 { if len(accounts) > 0 {
accountMap := make(map[string]string) accountMap := make(map[string]string)
for i := range accounts { for i := range accounts {
accountMap[accounts[i].ID] = accounts[i].Username accountMap[accounts[i].Acct] = accounts[i].Username
} }
list.Accounts = accountMap list.Accounts = accountMap

View file

@ -105,17 +105,19 @@ func (l List) Display(noColor bool) string {
) )
if len(l.Accounts) > 0 { if len(l.Accounts) > 0 {
for id, name := range l.Accounts { for acct, name := range l.Accounts {
output += fmt.Sprintf( output += fmt.Sprintf(
"\n • %s (%s)", "\n • %s (%s)",
utilities.DisplayNameFormat(noColor, name), utilities.DisplayNameFormat(noColor, name),
id, acct,
) )
} }
} else { } else {
output += "\n None" output += "\n None"
} }
output += "\n"
return output return output
} }