MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / CheckGHCLI

Function CheckGHCLI

internal/git/push.go:12–26  ·  view source on GitHub ↗

CheckGHCLI validates that the GitHub CLI is installed and authenticated.

()

Source from the content-addressed store, hash-verified

10
11// CheckGHCLI validates that the GitHub CLI is installed and authenticated.
12func CheckGHCLI() (installed bool, authenticated bool, err error) {
13 // Check if gh is installed
14 _, err = exec.LookPath("gh")
15 if err != nil {
16 return false, false, nil
17 }
18
19 // Check if gh is authenticated
20 cmd := exec.Command("gh", "auth", "status")
21 if err := cmd.Run(); err != nil {
22 return true, false, nil
23 }
24
25 return true, true, nil
26}
27
28// PushBranch pushes the branch to origin.
29func PushBranch(dir, branch string) error {

Callers 4

handleSettingsKeysMethod · 0.92
confirmPostCompletionMethod · 0.92
handleGHErrorKeysMethod · 0.92
TestCheckGHCLIFunction · 0.85

Calls 1

RunMethod · 0.80

Tested by 1

TestCheckGHCLIFunction · 0.68