MCPcopy Index your code
hub / github.com/git-bug/git-bug / runBridgeAuthShow

Function runBridgeAuthShow

commands/bridge/bridge_auth_show.go:31–58  ·  view source on GitHub ↗
(env *execenv.Env, args []string)

Source from the content-addressed store, hash-verified

29}
30
31func runBridgeAuthShow(env *execenv.Env, args []string) error {
32 cred, err := auth.LoadWithPrefix(env.Repo, args[0])
33 if err != nil {
34 return err
35 }
36
37 env.Out.Printf("Id: %s\n", cred.ID())
38 env.Out.Printf("Target: %s\n", cred.Target())
39 env.Out.Printf("Kind: %s\n", cred.Kind())
40 env.Out.Printf("Creation: %s\n", cred.CreateTime().Format(time.RFC822))
41
42 switch cred := cred.(type) {
43 case *auth.Token:
44 env.Out.Printf("Value: %s\n", cred.Value)
45 }
46
47 env.Out.Println("Metadata:")
48
49 meta := make([]string, 0, len(cred.Metadata()))
50 for key, value := range cred.Metadata() {
51 meta = append(meta, fmt.Sprintf(" %s --> %s\n", key, value))
52 }
53 sort.Strings(meta)
54
55 env.Out.Print(strings.Join(meta, ""))
56
57 return nil
58}

Callers 1

newBridgeAuthShowFunction · 0.85

Calls 10

LoadWithPrefixFunction · 0.92
PrintfMethod · 0.65
IDMethod · 0.65
TargetMethod · 0.65
KindMethod · 0.65
CreateTimeMethod · 0.65
PrintlnMethod · 0.65
MetadataMethod · 0.65
PrintMethod · 0.65
FormatMethod · 0.45

Tested by

no test coverage detected