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

Function runBridgeAuth

commands/bridge/bridge_auth.go:33–65  ·  view source on GitHub ↗
(env *execenv.Env)

Source from the content-addressed store, hash-verified

31}
32
33func runBridgeAuth(env *execenv.Env) error {
34 creds, err := auth.List(env.Backend)
35 if err != nil {
36 return err
37 }
38
39 for _, cred := range creds {
40 targetFmt := text.LeftPadMaxLine(cred.Target(), 10, 0)
41
42 var value string
43 switch cred := cred.(type) {
44 case *auth.Token:
45 value = cred.Value
46 }
47
48 meta := make([]string, 0, len(cred.Metadata()))
49 for k, v := range cred.Metadata() {
50 meta = append(meta, k+":"+v)
51 }
52 sort.Strings(meta)
53 metaFmt := strings.Join(meta, ",")
54
55 env.Out.Printf("%s %s %s %s %s\n",
56 colors.Cyan(cred.ID().Human()),
57 colors.Yellow(targetFmt),
58 colors.Magenta(cred.Kind()),
59 value,
60 metaFmt,
61 )
62 }
63
64 return nil
65}

Callers 1

newBridgeAuthCommandFunction · 0.85

Calls 7

ListFunction · 0.92
TargetMethod · 0.65
MetadataMethod · 0.65
PrintfMethod · 0.65
IDMethod · 0.65
KindMethod · 0.65
HumanMethod · 0.45

Tested by

no test coverage detected