| 1 | import { hubRequest } from "../api.js"; |
| 2 | |
| 3 | interface Repo { |
| 4 | id: number; |
| 5 | owner_name: string; |
| 6 | name: string; |
| 7 | description: string | null; |
| 8 | default_branch: string; |
| 9 | created_at: string; |
| 10 | } |
| 11 | |
| 12 | export async function repoList() { |
| 13 | const { repos } = await hubRequest<{ repos: Repo[] }>("/api/repos"); |
| 14 | |
| 15 | if (repos.length === 0) { |
| 16 | console.log("No repositories."); |
| 17 | return; |
| 18 | } |
| 19 | |
| 20 | for (const repo of repos) { |
| 21 | const desc = repo.description ? ` ${repo.description}` : ""; |
| 22 | console.log(`${repo.owner_name}/${repo.name}${desc}`); |
| 23 | } |
| 24 | } |
| 25 | |