1package commands
2
3import (
4 "fmt"
5 "time"
6
7 "github.com/spf13/cobra"
8
9 "github.com/MichaelMure/git-bug/bridge/core"
10)
11
12func runBridgeAuthShow(cmd *cobra.Command, args []string) error {
13 token, err := core.LoadTokenPrefix(repo, args[0])
14 if err != nil {
15 return err
16 }
17
18 fmt.Printf("Id: %s\n", token.ID())
19 fmt.Printf("Target: %s\n", token.Target)
20 fmt.Printf("Type: token\n")
21 fmt.Printf("Value: %s\n", token.Value)
22 fmt.Printf("Creation: %s\n", token.CreateTime.Format(time.RFC822))
23
24 return nil
25}
26
27var bridgeAuthShowCmd = &cobra.Command{
28 Use: "show",
29 Short: "Display an authentication credential.",
30 PreRunE: loadRepo,
31 RunE: runBridgeAuthShow,
32 Args: cobra.ExactArgs(1),
33}
34
35func init() {
36 bridgeAuthCmd.AddCommand(bridgeAuthShowCmd)
37}