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

Function NewCmdCredential

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

Source from the content-addressed store, hash-verified

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