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

Method Config

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

Source from the content-addressed store, hash-verified

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