promptForSkillOrigin asks the user for the source repository of a skill that has no GitHub metadata.
(p prompter.Prompter, skillName string)
| 721 | // promptForSkillOrigin asks the user for the source repository of a skill |
| 722 | // that has no GitHub metadata. |
| 723 | func promptForSkillOrigin(p prompter.Prompter, skillName string) (owner, repo, reason string, ok bool, err error) { |
| 724 | input, err := p.Input( |
| 725 | fmt.Sprintf("Repository for %s (owner/repo):", skillName), "") |
| 726 | if err != nil { |
| 727 | return "", "", "", false, err |
| 728 | } |
| 729 | input = strings.TrimSpace(input) |
| 730 | if input == "" { |
| 731 | return "", "", "", false, nil |
| 732 | } |
| 733 | r, err := ghrepo.FromFullName(input) |
| 734 | if err != nil { |
| 735 | //nolint:nilerr // intentionally converting parse error into a user-facing validation message |
| 736 | return "", "", fmt.Sprintf("invalid repository %q: expected owner/repo", input), false, nil |
| 737 | } |
| 738 | return r.RepoOwner(), r.RepoName(), "", true, nil |
| 739 | } |