diff --git a/cmd/enbas/add.go b/cmd/enbas/add.go index 6ca7bfc..c1afa29 100644 --- a/cmd/enbas/add.go +++ b/cmd/enbas/add.go @@ -69,7 +69,6 @@ func (c *addCommand) addAccountsToList(gtsClient *client.Client) error { } fmt.Println("Successfully added the account(s) to the list.") - // TODO: ...then print the list with the accounts in them. return nil } diff --git a/cmd/enbas/remove.go b/cmd/enbas/remove.go index 36ed293..951a939 100644 --- a/cmd/enbas/remove.go +++ b/cmd/enbas/remove.go @@ -68,8 +68,7 @@ func (c *removeCommand) removeAccountsFromList(gtsClient *client.Client) error { return fmt.Errorf("unable to remove the accounts from the list; %w", err) } - fmt.Println("Successfully removed the account(s) to the list.") - // TODO: ...then print the list with the accounts in them. + fmt.Println("Successfully removed the account(s) from the list.") return nil } diff --git a/cmd/enbas/show.go b/cmd/enbas/show.go index a83d63c..eaf5dd3 100644 --- a/cmd/enbas/show.go +++ b/cmd/enbas/show.go @@ -173,13 +173,17 @@ func (c *showCommand) showList(gts *client.Client) error { return fmt.Errorf("unable to retrieve the list; %w", err) } - accounts, err := gts.GetAccountsFromList(c.listID, 0) + accounts, err := gts.GetAccountsFromList(c.listID, 40) if err != nil { return fmt.Errorf("unable to retrieve the accounts from the list; %w", err) } - for i := range accounts { - list.Accounts[accounts[i].ID] = accounts[i].Username + if len(accounts) > 0 { + accountMap := make(map[string]string) + for i := range accounts { + accountMap[accounts[i].ID] = accounts[i].Username + } + list.Accounts = accountMap } fmt.Println(list) diff --git a/internal/model/list.go b/internal/model/list.go index 1ab797e..c2a839b 100644 --- a/internal/model/list.go +++ b/internal/model/list.go @@ -99,7 +99,11 @@ func (l List) String() string { if len(l.Accounts) > 0 { for id, name := range l.Accounts { - output += fmt.Sprintf("- %s (%s)", name, id) + output += fmt.Sprintf( + "\n - %s (%s)", + utilities.DisplayNameFormat(name), + id, + ) } } else { output += "\n None"