From b92adfcb5f79f2b32c3dafb0fc3e7f1b753b6197 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sun, 8 Dec 2019 21:15:06 +0100 Subject: bridge: huge refactor to accept multiple kind of credentials --- commands/bridge_auth_show.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'commands/bridge_auth_show.go') diff --git a/commands/bridge_auth_show.go b/commands/bridge_auth_show.go index 94141b93..5352957d 100644 --- a/commands/bridge_auth_show.go +++ b/commands/bridge_auth_show.go @@ -6,20 +6,24 @@ import ( "github.com/spf13/cobra" - "github.com/MichaelMure/git-bug/bridge/core" + "github.com/MichaelMure/git-bug/bridge/core/auth" ) func runBridgeAuthShow(cmd *cobra.Command, args []string) error { - token, err := core.LoadTokenPrefix(repo, args[0]) + cred, err := auth.LoadWithPrefix(repo, args[0]) if err != nil { return err } - fmt.Printf("Id: %s\n", token.ID()) - fmt.Printf("Target: %s\n", token.Target) - fmt.Printf("Type: token\n") - fmt.Printf("Value: %s\n", token.Value) - fmt.Printf("Creation: %s\n", token.CreateTime.Format(time.RFC822)) + fmt.Printf("Id: %s\n", cred.ID()) + fmt.Printf("Target: %s\n", cred.Target()) + fmt.Printf("Kind: %s\n", cred.Kind()) + fmt.Printf("Creation: %s\n", cred.CreateTime().Format(time.RFC822)) + + switch cred := cred.(type) { + case *auth.Token: + fmt.Printf("Value: %s\n", cred.Value) + } return nil } -- cgit