(opts: CommonOptions, deps: AgentDeps = {})
| 672 | } |
| 673 | |
| 674 | export async function runList(opts: CommonOptions, deps: AgentDeps = {}): Promise<void> { |
| 675 | const out = makeOutput(opts.output, deps); |
| 676 | |
| 677 | const results: ListResult[] = ( |
| 678 | Object.entries(TARGETS) as [AgentTarget, { status: string; mode: string; path: string }][] |
| 679 | ).map(([t, spec]) => ({ |
| 680 | target: t, |
| 681 | status: spec.status, |
| 682 | mode: spec.mode, |
| 683 | path: spec.path, |
| 684 | })); |
| 685 | |
| 686 | out.print(results, data => { |
| 687 | const items = data as ListResult[]; |
| 688 | const header = `${'TARGET'.padEnd(14)} ${'STATUS'.padEnd(12)} ${'MODE'.padEnd(18)} PATH`; |
| 689 | const rows = items.map( |
| 690 | r => `${r.target.padEnd(14)} ${r.status.padEnd(12)} ${r.mode.padEnd(18)} ${r.path}`, |
| 691 | ); |
| 692 | return [header, ...rows].join('\n'); |
| 693 | }); |
| 694 | } |
| 695 | |
| 696 | // --------------------------------------------------------------------------- |
| 697 | // Command factory |
no test coverage detected