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

Function fetchDefaultsVariable

pkg/cli/env_command.go:524–533  ·  view source on GitHub ↗
(target defaultsTarget, name string)

Source from the content-addressed store, hash-verified

522}
523
524func fetchDefaultsVariable(target defaultsTarget, name string) (string, error) {
525 out, err := runDefaultsGH("api", target.variableEndpoint(name), "--jq", ".value")
526 if err != nil {
527 if isDefaultsNotFoundError(err, out) {
528 return "", nil
529 }
530 return "", fmt.Errorf("failed to fetch %s: %w", name, err)
531 }
532 return strings.TrimRight(string(out), "\r\n"), nil
533}
534
535func upsertDefaultsVariable(target defaultsTarget, name, value string) error {
536 patchOut, patchErr := runDefaultsGH("api", "-X", "PATCH", target.variableEndpoint(name), "-f", "name="+name, "-f", "value="+value)

Callers 1

defaultsGetToFileFunction · 0.85

Calls 4

runDefaultsGHFunction · 0.85
isDefaultsNotFoundErrorFunction · 0.85
variableEndpointMethod · 0.80
ErrorfMethod · 0.45

Tested by

no test coverage detected