MCPcopy
hub / github.com/cli/cli / promptForSkillOrigin

Function promptForSkillOrigin

pkg/cmd/skills/update/update.go:643–659  ·  view source on GitHub ↗

promptForSkillOrigin asks the user for the source repository of a skill that has no GitHub metadata.

(p prompter.Prompter, skillName string)

Source from the content-addressed store, hash-verified

641// promptForSkillOrigin asks the user for the source repository of a skill
642// that has no GitHub metadata.
643func promptForSkillOrigin(p prompter.Prompter, skillName string) (owner, repo, reason string, ok bool, err error) {
644 input, err := p.Input(
645 fmt.Sprintf("Repository for %s (owner/repo):", skillName), "")
646 if err != nil {
647 return "", "", "", false, err
648 }
649 input = strings.TrimSpace(input)
650 if input == "" {
651 return "", "", "", false, nil
652 }
653 r, err := ghrepo.FromFullName(input)
654 if err != nil {
655 //nolint:nilerr // intentionally converting parse error into a user-facing validation message
656 return "", "", fmt.Sprintf("invalid repository %q: expected owner/repo", input), false, nil
657 }
658 return r.RepoOwner(), r.RepoName(), "", true, nil
659}

Callers 2

updateRunFunction · 0.85
TestPromptForSkillOriginFunction · 0.85

Calls 4

FromFullNameFunction · 0.92
InputMethod · 0.65
RepoOwnerMethod · 0.65
RepoNameMethod · 0.65

Tested by 1

TestPromptForSkillOriginFunction · 0.68