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 runBridgeTokenShow(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("Value: %s\n", token.Value)
20 fmt.Printf("Target: %s\n", token.Target)
21 fmt.Printf("Creation: %s\n", token.CreateTime.Format(time.RFC822))
22
23 return nil
24}
25
26var bridgeTokenShowCmd = &cobra.Command{
27 Use: "show",
28 Short: "Display a token.",
29 PreRunE: loadRepo,
30 RunE: runBridgeTokenShow,
31 Args: cobra.ExactArgs(1),
32}
33
34func init() {
35 bridgeTokenCmd.AddCommand(bridgeTokenShowCmd)
36}