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

Function Current

cmd/current.go:15–34  ·  view source on GitHub ↗

Current returns `current` command

(cfg storage, v vcs)

Source from the content-addressed store, hash-verified

13
14// Current returns `current` command
15func Current(cfg storage, v vcs) *cobra.Command {
16 return &cobra.Command{
17 Use: "current",
18 Aliases: []string{"c"},
19 Short: "Show the current profile",
20 Long: "Show the selected profile for the current repository.",
21 Example: "git-profile current",
22 PreRun: func(cmd *cobra.Command, _ []string) {
23 check(cmd, cfg, v)
24 },
25 Run: func(cmd *cobra.Command, _ []string) {
26 profile, err := v.Get(currentProfileKey)
27 if len(profile) == 0 || err != nil {
28 profile = defaultProfileName
29 }
30
31 ui.Println(cmd, ui.SuccessStyle, "Current profile: %s", profile)
32 },
33 }
34}

Callers 2

TestCurrentFunction · 0.85
initMethod · 0.85

Calls 3

PrintlnFunction · 0.92
checkFunction · 0.85
GetMethod · 0.65

Tested by 1

TestCurrentFunction · 0.68