MCPcopy Create free account
hub / github.com/dotzero/git-profile / List

Function List

cmd/list.go:10–32  ·  view source on GitHub ↗

List returns `list` command

(cfg storage, v vcs)

Source from the content-addressed store, hash-verified

8
9// List returns `list` command
10func List(cfg storage, v vcs) *cobra.Command {
11 return &cobra.Command{
12 Use: "list",
13 Aliases: []string{"l"},
14 Short: "List profiles",
15 Long: "Display the list of available profiles.",
16 Example: "git-profile list",
17 Run: func(cmd *cobra.Command, _ []string) {
18 check(cmd, cfg, v)
19
20 ui.Println(cmd, ui.InfoStyle, "Available profiles:")
21
22 for _, name := range cfg.Names() {
23 ui.Println(cmd, ui.SuccessStyle, "- %s:", name)
24
25 profile, _ := cfg.Lookup(name)
26 for _, entry := range profile {
27 ui.Println(cmd, ui.DefaultStyle, " %s: %s", entry.Key, entry.Value)
28 }
29 }
30 },
31 }
32}

Callers 2

TestListFunction · 0.85
initMethod · 0.85

Calls 4

PrintlnFunction · 0.92
checkFunction · 0.85
NamesMethod · 0.65
LookupMethod · 0.65

Tested by 1

TestListFunction · 0.68