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

Method Config

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

Source from the content-addressed store, hash-verified

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

Calls 3

CommandMethod · 0.95
firstLineFunction · 0.70
OutputMethod · 0.65