promptForSkillOrigin asks the user for the source repository of a skill that has no GitHub metadata.
(p prompter.Prompter, skillName string)
| 641 | // promptForSkillOrigin asks the user for the source repository of a skill |
| 642 | // that has no GitHub metadata. |
| 643 | func 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 | } |