MCPcopy
hub / github.com/cli/cli / NewCmdCredential

Function NewCmdCredential

pkg/cmd/auth/gitcredential/helper.go:28–56  ·  view source on GitHub ↗
(f *cmdutil.Factory, runF func(*CredentialOptions) error)

Source from the content-addressed store, hash-verified

26}
27
28func NewCmdCredential(f *cmdutil.Factory, runF func(*CredentialOptions) error) *cobra.Command {
29 opts := &CredentialOptions{
30 IO: f.IOStreams,
31 Config: func() (config, error) {
32 cfg, err := f.Config()
33 if err != nil {
34 return nil, err
35 }
36 return cfg.Authentication(), nil
37 },
38 }
39
40 cmd := &cobra.Command{
41 Use: "git-credential",
42 Args: cobra.ExactArgs(1),
43 Short: "Implements git credential helper protocol",
44 Hidden: true,
45 RunE: func(cmd *cobra.Command, args []string) error {
46 opts.Operation = args[0]
47
48 if runF != nil {
49 return runF(opts)
50 }
51 return helperRun(opts)
52 },
53 }
54
55 return cmd
56}
57
58func helperRun(opts *CredentialOptions) error {
59 if opts.Operation == "store" {

Callers

nothing calls this directly

Calls 3

helperRunFunction · 0.85
ConfigMethod · 0.65
AuthenticationMethod · 0.65

Tested by

no test coverage detected