| … | … | @@ -10,6 +10,7 @@ export const usage = `pgh repo — browse repos served by the daemon |
| 10 | 10 | pgh repo info <name> |
| 11 | 11 | pgh repo branches <name> |
| 12 | 12 | pgh repo tags <name> |
| 13 | pgh repo create <name> [--branch <b>] Host a new bare repo (default: main) |
| 13 | 14 | pgh repo scan Rescan the repos dir |
| 14 | 15 | |
| 15 | 16 | Per-repo P2P pairing (issue #35): |
| … | … | @@ -65,6 +66,17 @@ export async function run (client, args) { |
| 65 | 66 | return client.call('repo-tags', { name }) |
| 66 | 67 | } |
| 67 | 68 | |
| 69 | // Host a new bare repo in one call: init --bare + symbolic-ref HEAD + scan + |
| 70 | // serve, all daemon-side. Must be matched BEFORE the bare-name fallthrough at |
| 71 | // the bottom, or `create` would be read as a repo name to show. |
| 72 | if (sub === 'create') { |
| 73 | const name = args[1] |
| 74 | if (!name) throw new Error('usage: pgh repo create <name> [--branch <branch>]') |
| 75 | const bi = args.indexOf('--branch') |
| 76 | const branch = (bi !== -1 && args[bi + 1]) || 'main' |
| 77 | return client.call('create-repo', { name, branch }) |
| 78 | } |
| 79 | |
| 68 | 80 | if (sub === 'scan') { |
| 69 | 81 | return client.call('scan-repos', {}) |
| 70 | 82 | } |