diff options
author | Michael Muré <batolettre@gmail.com> | 2020-02-09 20:08:12 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-02-09 20:23:38 +0100 |
commit | b3d3612393387c83fa43f908dbb8e2a71068c834 (patch) | |
tree | e4609e21dc74e535d45b38cd7d0504681c544160 /commands/bridge_auth_show.go | |
parent | dca85b309a0a82e9993a345964d0831ab2876fb4 (diff) | |
parent | 3caffeef4d2ed25d4eb5d4bfd262f4fc3b92561f (diff) | |
download | git-bug-b3d3612393387c83fa43f908dbb8e2a71068c834.tar.gz |
Merge remote-tracking branch 'origin/master' into cheshirekow-jira
Diffstat (limited to 'commands/bridge_auth_show.go')
-rw-r--r-- | commands/bridge_auth_show.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/commands/bridge_auth_show.go b/commands/bridge_auth_show.go index 5352957d..fbbf60a7 100644 --- a/commands/bridge_auth_show.go +++ b/commands/bridge_auth_show.go @@ -2,14 +2,25 @@ package commands import ( "fmt" + "sort" + "strings" "time" "github.com/spf13/cobra" "github.com/MichaelMure/git-bug/bridge/core/auth" + "github.com/MichaelMure/git-bug/cache" + "github.com/MichaelMure/git-bug/util/interrupt" ) func runBridgeAuthShow(cmd *cobra.Command, args []string) error { + backend, err := cache.NewRepoCache(repo) + if err != nil { + return err + } + defer backend.Close() + interrupt.RegisterCleaner(backend.Close) + cred, err := auth.LoadWithPrefix(repo, args[0]) if err != nil { return err @@ -25,6 +36,16 @@ func runBridgeAuthShow(cmd *cobra.Command, args []string) error { fmt.Printf("Value: %s\n", cred.Value) } + fmt.Println("Metadata:") + + meta := make([]string, 0, len(cred.Metadata())) + for key, value := range cred.Metadata() { + meta = append(meta, fmt.Sprintf(" %s --> %s\n", key, value)) + } + sort.Strings(meta) + + fmt.Print(strings.Join(meta, "")) + return nil } |