MCPcopy Create free account
hub / github.com/github/gh-aw / runDefaultsGH

Function runDefaultsGH

pkg/cli/env_command.go:504–522  ·  view source on GitHub ↗
(args ...string)

Source from the content-addressed store, hash-verified

502}
503
504func runDefaultsGH(args ...string) ([]byte, error) {
505 envCmdLog.Printf("Running gh command: %v", args)
506 cmd := defaultsExecGH(args...)
507 out, err := cmd.CombinedOutput()
508 if err != nil {
509 command := "gh " + strings.Join(args, " ")
510 var exitErr *exec.ExitError
511 if errors.As(err, &exitErr) {
512 return out, &defaultsGHError{
513 command: command,
514 exitCode: exitErr.ExitCode(),
515 output: string(out),
516 cause: err,
517 }
518 }
519 return out, fmt.Errorf("%s: %w", command, err)
520 }
521 return out, nil
522}
523
524func fetchDefaultsVariable(target defaultsTarget, name string) (string, error) {
525 out, err := runDefaultsGH("api", target.variableEndpoint(name), "--jq", ".value")

Callers 3

fetchDefaultsVariableFunction · 0.85
upsertDefaultsVariableFunction · 0.85
deleteDefaultsVariableFunction · 0.85

Calls 2

PrintfMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected