promptSearchInstall shows an interactive multi-select picker over GitHub search results, then asks for a target app, and installs the selected skills — matching the `gh skill search` interactive flow.
(results []ghSearchResult, kind entities.Kind, out io.Writer)
| 1861 | // search results, then asks for a target app, and installs the selected |
| 1862 | // skills — matching the `gh skill search` interactive flow. |
| 1863 | func promptSearchInstall(results []ghSearchResult, kind entities.Kind, out io.Writer) error { |
| 1864 | // Build multi-select items matching gh skill search / cli/cli format: |
| 1865 | // > [ ] scope/name owner/repo ★ stars |
| 1866 | // Full description text |
| 1867 | msItems := make([]multiSelectItem, len(results)) |
| 1868 | for i, r := range results { |
| 1869 | id := r.ID |
| 1870 | if id == "" { |
| 1871 | id = r.Name |
| 1872 | } |
| 1873 | stars := formatStars(r.Stars) |
| 1874 | label := fmt.Sprintf("%-40s %-35s", id, r.Repo) |
| 1875 | if stars != "" { |
| 1876 | label += " " + stars |
| 1877 | } |
| 1878 | msItems[i] = multiSelectItem{ |
| 1879 | label: label, |
| 1880 | description: r.Description, |
| 1881 | } |
| 1882 | } |
| 1883 | |
| 1884 | selected, err := runMultiSelect("Select skills to install:", msItems) |
| 1885 | if err != nil { |
| 1886 | return err |
| 1887 | } |
| 1888 | if len(selected) == 0 { |
| 1889 | return nil |
| 1890 | } |
| 1891 | |
| 1892 | // Map selected labels back to results (label starts with the skill ID). |
| 1893 | var toInstall []ghSearchResult |
| 1894 | for _, label := range selected { |
| 1895 | id := strings.TrimSpace(strings.Fields(label)[0]) |
| 1896 | for _, r := range results { |
| 1897 | rid := r.ID |
| 1898 | if rid == "" { |
| 1899 | rid = r.Name |
| 1900 | } |
| 1901 | if rid == id { |
| 1902 | toInstall = append(toInstall, r) |
| 1903 | break |
| 1904 | } |
| 1905 | } |
| 1906 | } |
| 1907 | if len(toInstall) == 0 { |
| 1908 | return nil |
| 1909 | } |
| 1910 | |
| 1911 | // Pick target agent(s) — multi-select. |
| 1912 | apps, err := promptSelectApp(kind) |
| 1913 | if err != nil { |
| 1914 | return err |
| 1915 | } |
| 1916 | if len(apps) == 0 { |
| 1917 | return nil |
| 1918 | } |
| 1919 | appsFn := func() ([]string, error) { return apps, nil } |
| 1920 |
no test coverage detected