MCPcopy
hub / github.com/cli/cli / New

Function New

pkg/cmd/factory/default.go:26–47  ·  view source on GitHub ↗
(appVersion string, invokingAgent string, cfgFunc func() (gh.Config, error), ios *iostreams.IOStreams, executablePath string, telemetryDisabler ghtelemetry.Disabler)

Source from the content-addressed store, hash-verified

24var ssoURLRE = regexp.MustCompile(`\burl=([^;]+)`)
25
26func New(appVersion string, invokingAgent string, cfgFunc func() (gh.Config, error), ios *iostreams.IOStreams, executablePath string, telemetryDisabler ghtelemetry.Disabler) *cmdutil.Factory {
27 f := &cmdutil.Factory{
28 AppVersion: appVersion,
29 InvokingAgent: invokingAgent,
30 Config: cfgFunc,
31 ExecutablePath: executablePath,
32 }
33
34 f.IOStreams = ios
35 f.HttpClient = HttpClientFunc(cfgFunc, ios, appVersion, invokingAgent, telemetryDisabler)
36 f.PlainHttpClient = plainHttpClientFunc(ios, appVersion, invokingAgent, telemetryDisabler)
37 f.ExternalHttpClient = externalHttpClientFunc(ios, appVersion)
38 f.GitClient = newGitClient(f) // Depends on IOStreams, and Executable
39 f.Remotes = remotesFunc(f) // Depends on Config, and GitClient
40 f.BaseRepo = BaseRepoFunc(f.Remotes)
41 f.Prompter = newPrompter(f) // Depends on Config and IOStreams
42 f.Browser = newBrowser(f) // Depends on Config, and IOStreams
43 f.ExtensionManager = extensionManager(f) // Depends on Config, HttpClient, and IOStreams
44 f.Branch = branchFunc(f) // Depends on GitClient
45
46 return f
47}
48
49// BaseRepoFunc requests a list of Remotes, and selects the first one.
50// Although Remotes is injected via the factory so it looks like the function might

Callers 1

MainFunction · 0.92

Calls 10

HttpClientFuncFunction · 0.85
plainHttpClientFuncFunction · 0.85
externalHttpClientFuncFunction · 0.85
newGitClientFunction · 0.85
remotesFuncFunction · 0.85
BaseRepoFuncFunction · 0.85
newPrompterFunction · 0.85
newBrowserFunction · 0.85
extensionManagerFunction · 0.85
branchFuncFunction · 0.85

Tested by

no test coverage detected