ghOutput runs a gh CLI command and returns trimmed stdout.
(args ...string)
| 11 | |
| 12 | // ghOutput runs a gh CLI command and returns trimmed stdout. |
| 13 | func ghOutput(args ...string) (string, error) { |
| 14 | cmd := exec.Command("gh", args...) |
| 15 | out, err := cmd.Output() |
| 16 | if err != nil { |
| 17 | var exitErr *exec.ExitError |
| 18 | if errors.As(err, &exitErr) { |
| 19 | return "", exitErr |
| 20 | } |
| 21 | return "", err |
| 22 | } |
| 23 | return strings.TrimSpace(string(out)), nil |
| 24 | } |
| 25 | |
| 26 | // checkGHAuth verifies that the gh CLI is installed and |
| 27 | // authenticated. Returns true if gh is available. |
no test coverage detected