aboutsummaryrefslogtreecommitdiffstats
path: root/commands/bridge_auth.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-02-09 01:31:00 +0100
committerGitHub <noreply@github.com>2020-02-09 01:31:00 +0100
commit9e1a987b4d94dc5c2115423ede5954d4faf1d342 (patch)
treee30bb28d55444a7d1e66c8fa8b8ba7d413805473 /commands/bridge_auth.go
parent97bc5ccd229b7b438262a84e3c42783b4d4a82af (diff)
parent9b1aaa032d36e1ac05504916e359f767d1622d9d (diff)
downloadgit-bug-9e1a987b4d94dc5c2115423ede5954d4faf1d342.tar.gz
Merge pull request #294 from MichaelMure/cred-metadata
Cred metadata
Diffstat (limited to 'commands/bridge_auth.go')
-rw-r--r--commands/bridge_auth.go26
1 files changed, 8 insertions, 18 deletions
diff --git a/commands/bridge_auth.go b/commands/bridge_auth.go
index bfbab33c..3a0e0c29 100644
--- a/commands/bridge_auth.go
+++ b/commands/bridge_auth.go
@@ -2,6 +2,8 @@ package commands
import (
"fmt"
+ "sort"
+ "strings"
"github.com/spf13/cobra"
@@ -26,8 +28,6 @@ func runBridgeAuth(cmd *cobra.Command, args []string) error {
return err
}
- defaultUser, _ := backend.GetUserIdentity()
-
for _, cred := range creds {
targetFmt := text.LeftPadMaxLine(cred.Target(), 10, 0)
@@ -37,29 +37,19 @@ func runBridgeAuth(cmd *cobra.Command, args []string) error {
value = cred.Value
}
- var userFmt string
-
- switch cred.UserId() {
- case auth.DefaultUserId:
- userFmt = colors.Red("default user")
- default:
- user, err := backend.ResolveIdentity(cred.UserId())
- if err != nil {
- return err
- }
- userFmt = user.DisplayName()
-
- if cred.UserId() == defaultUser.Id() {
- userFmt = colors.Red(userFmt)
- }
+ meta := make([]string, 0, len(cred.Metadata()))
+ for k, v := range cred.Metadata() {
+ meta = append(meta, k+":"+v)
}
+ sort.Strings(meta)
+ metaFmt := strings.Join(meta, ",")
fmt.Printf("%s %s %s %s %s\n",
colors.Cyan(cred.ID().Human()),
colors.Yellow(targetFmt),
colors.Magenta(cred.Kind()),
- userFmt,
value,
+ metaFmt,
)
}