MCPcopy Index your code
hub / github.com/cli/cli / resolveScope

Function resolveScope

pkg/cmd/skills/install/install.go:954–977  ·  view source on GitHub ↗
(opts *InstallOptions, canPrompt bool)

Source from the content-addressed store, hash-verified

952}
953
954func resolveScope(opts *InstallOptions, canPrompt bool) (registry.Scope, error) {
955 if opts.Dir != "" {
956 return registry.Scope(opts.Scope), nil
957 }
958
959 if opts.ScopeChanged || !canPrompt {
960 return registry.Scope(opts.Scope), nil
961 }
962
963 var repoName string
964 if opts.Remotes != nil {
965 if remotes, err := opts.Remotes(); err == nil && len(remotes) > 0 {
966 repoName = ghrepo.FullName(remotes[0].Repo)
967 }
968 }
969 idx, err := opts.Prompter.Select("Installation scope:", "", registry.ScopeLabels(repoName))
970 if err != nil {
971 return "", err
972 }
973 if idx == 0 {
974 return registry.ScopeProject, nil
975 }
976 return registry.ScopeUser, nil
977}
978
979func buildInstallPlans(opts *InstallOptions, selectedSkills []discovery.Skill, selectedHosts []*registry.AgentHost, scope registry.Scope, gitRoot, homeDir string, canPrompt bool) ([]installPlan, error) {
980 byDir := make(map[string]*installPlan)

Callers 2

installRunFunction · 0.85
runLocalInstallFunction · 0.85

Calls 5

ScopeTypeAlias · 0.92
FullNameFunction · 0.92
ScopeLabelsFunction · 0.92
RemotesMethod · 0.65
SelectMethod · 0.65

Tested by

no test coverage detected