(opts *InstallOptions, skills []discovery.Skill)
| 794 | } |
| 795 | |
| 796 | func matchSkillByName(opts *InstallOptions, skills []discovery.Skill) ([]discovery.Skill, error) { |
| 797 | for _, s := range skills { |
| 798 | if s.DisplayName() == opts.SkillName { |
| 799 | return []discovery.Skill{s}, nil |
| 800 | } |
| 801 | } |
| 802 | |
| 803 | var matches []discovery.Skill |
| 804 | for _, s := range skills { |
| 805 | if s.Name == opts.SkillName { |
| 806 | matches = append(matches, s) |
| 807 | } |
| 808 | } |
| 809 | |
| 810 | switch len(matches) { |
| 811 | case 0: |
| 812 | return nil, fmt.Errorf("skill %q not found in %s", opts.SkillName, ghrepo.FullName(opts.repo)) |
| 813 | case 1: |
| 814 | return matches, nil |
| 815 | default: |
| 816 | names := make([]string, len(matches)) |
| 817 | for i, m := range matches { |
| 818 | names[i] = m.DisplayName() |
| 819 | } |
| 820 | return nil, fmt.Errorf( |
| 821 | "skill name %q is ambiguous, multiple matches found:\n %s\n Specify the full name (e.g. %s) to disambiguate", |
| 822 | opts.SkillName, strings.Join(names, "\n "), names[0], |
| 823 | ) |
| 824 | } |
| 825 | } |
| 826 | |
| 827 | func matchLocalSkillByName(opts *InstallOptions, skills []discovery.Skill) ([]discovery.Skill, error) { |
| 828 | for _, s := range skills { |
nothing calls this directly
no test coverage detected