diff options
author | Michael Muré <batolettre@gmail.com> | 2019-12-10 00:42:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-10 00:42:23 +0100 |
commit | f1ed857cbd3a253d77b31c0c896fdc4ade40844f (patch) | |
tree | d1efe28a1fa666039bf8180bbed0202f0437910f /commands/bridge_auth_show.go | |
parent | 69af7a1e0c2647c354fd9c5b55a254ba677200e1 (diff) | |
parent | 58c0e5aac97eabc02fa890123f3845ae6fe632a8 (diff) | |
download | git-bug-f1ed857cbd3a253d77b31c0c896fdc4ade40844f.tar.gz |
Merge pull request #271 from MichaelMure/bridge-credentials
bridge: huge refactor to accept multiple kind of credentials
Diffstat (limited to 'commands/bridge_auth_show.go')
-rw-r--r-- | commands/bridge_auth_show.go | 18 |
1 files changed, 11 insertions, 7 deletions
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 } |