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

Function authenticatedCommand

pkg/cmd/pr/checkout/checkout.go:487–497  ·  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

485// credential-helper flags before all args, so a -C prefix would be displaced;
486// instead we strip it and apply it as cmd.Dir.
487func authenticatedCommand(client *git.Client, credentialPattern git.CredentialPattern, args []string) (*git.Command, error) {
488 if args[0] == "-C" {
489 cmd, err := client.AuthenticatedCommand(context.Background(), credentialPattern, args[2:]...)
490 if err != nil {
491 return nil, err
492 }
493 cmd.Dir = args[1]
494 return cmd, nil
495 }
496 return client.AuthenticatedCommand(context.Background(), credentialPattern, args...)
497}
498
499type PRResolver interface {
500 Resolve() (*api.PullRequest, ghrepo.Interface, error)

Callers 2

executeCmdsFunction · 0.85

Calls 1

AuthenticatedCommandMethod · 0.80