(
command: RuntimeHostProjectCommand,
overrides: Partial<RuntimeHostProjectCommandDeps> = {},
)
| 21 | } |
| 22 | |
| 23 | export async function runRuntimeHostProjectCli( |
| 24 | command: RuntimeHostProjectCommand, |
| 25 | overrides: Partial<RuntimeHostProjectCommandDeps> = {}, |
| 26 | ): Promise<number> { |
| 27 | const deps = { ...defaultDeps(), ...overrides }; |
| 28 | const connection = await deps.connect(command.rootPath); |
| 29 | try { |
| 30 | const result = |
| 31 | command.kind === 'list' |
| 32 | ? await readRuntimeHostProjectDetails(connection) |
| 33 | : await connection.request('project.catalog.mutate', { |
| 34 | kind: 'register', |
| 35 | path: resolve(command.path), |
| 36 | }); |
| 37 | deps.write(`${JSON.stringify(result, null, 2)}\n`); |
| 38 | return 0; |
| 39 | } finally { |
| 40 | await connection.close(); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | function defaultDeps(): RuntimeHostProjectCommandDeps { |
| 45 | return { |
no test coverage detected