MCPcopy
hub / github.com/cli/cli / Config

Method Config

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

Source from the content-addressed store, hash-verified

264}
265
266func (c *Client) Config(ctx context.Context, name string) (string, error) {
267 args := []string{"config", name}
268 cmd, err := c.Command(ctx, args...)
269 if err != nil {
270 return "", err
271 }
272 out, err := cmd.Output()
273 if err != nil {
274 var gitErr *GitError
275 if ok := errors.As(err, &gitErr); ok && gitErr.ExitCode == 1 {
276 gitErr.Stderr = fmt.Sprintf("unknown config key %s", name)
277 return "", gitErr
278 }
279 return "", err
280 }
281 return firstLine(out), nil
282}
283
284func (c *Client) UncommittedChangeCount(ctx context.Context) (int, error) {
285 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