MCPcopy Create free account
hub / github.com/cli/cli / Config

Method Config

git/client.go:329–345  ·  view source on GitHub ↗
(ctx context.Context, name string)

Source from the content-addressed store, hash-verified

327}
328
329func (c *Client) Config(ctx context.Context, name string) (string, error) {
330 args := []string{"config", name}
331 cmd, err := c.Command(ctx, args...)
332 if err != nil {
333 return "", err
334 }
335 out, err := cmd.Output()
336 if err != nil {
337 var gitErr *GitError
338 if ok := errors.As(err, &gitErr); ok && gitErr.ExitCode == 1 {
339 gitErr.Stderr = fmt.Sprintf("unknown config key %s", name)
340 return "", gitErr
341 }
342 return "", err
343 }
344 return firstLine(out), nil
345}
346
347func (c *Client) UncommittedChangeCount(ctx context.Context) (int, error) {
348 args := []string{"status", "--porcelain"}

Callers 3

TestClientConfigFunction · 0.95
PushDefaultMethod · 0.95
RemotePushDefaultMethod · 0.95

Calls 3

CommandMethod · 0.95
firstLineFunction · 0.85
OutputMethod · 0.65

Tested by 1

TestClientConfigFunction · 0.76