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

Function authenticatedCommand

pkg/cmd/pr/checkout/checkout.go:388–398  ·  view source on GitHub ↗

authenticatedCommand builds an authenticated git command, transparently handling a leading -C prefix. AuthenticatedCommand prepends credential-helper flags before all args, so a -C prefix would be displaced; instead we strip it and apply it as cmd.Dir.

(client *git.Client, credentialPattern git.CredentialPattern, args []string)

Source from the content-addressed store, hash-verified

386// credential-helper flags before all args, so a -C prefix would be displaced;
387// instead we strip it and apply it as cmd.Dir.
388func authenticatedCommand(client *git.Client, credentialPattern git.CredentialPattern, args []string) (*git.Command, error) {
389 if args[0] == "-C" {
390 cmd, err := client.AuthenticatedCommand(context.Background(), credentialPattern, args[2:]...)
391 if err != nil {
392 return nil, err
393 }
394 cmd.Dir = args[1]
395 return cmd, nil
396 }
397 return client.AuthenticatedCommand(context.Background(), credentialPattern, args...)
398}
399
400type PRResolver interface {
401 Resolve() (*api.PullRequest, ghrepo.Interface, error)

Callers 2

executeCmdsFunction · 0.85

Calls 1

AuthenticatedCommandMethod · 0.80