()
| 122 | } |
| 123 | |
| 124 | function main() { |
| 125 | const args = parseArgs(process.argv.slice(2)); |
| 126 | if (args.help) { |
| 127 | console.log(usage()); |
| 128 | return; |
| 129 | } |
| 130 | |
| 131 | const projectRoot = path.resolve(args.projectRoot); |
| 132 | const snapshot = collectDashboard({ projectRoot }); |
| 133 | const action = routeAction(snapshot); |
| 134 | const runResult = args.run ? runLocalCommand(projectRoot, action) : null; |
| 135 | const payload = { action, run: runResult }; |
| 136 | |
| 137 | if (args.json) process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`); |
| 138 | else process.stdout.write(render(action, runResult)); |
| 139 | |
| 140 | if (runResult && runResult.executed && runResult.status !== 0) { |
| 141 | process.exitCode = runResult.status; |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | if (require.main === module) main(); |
| 146 |
no test coverage detected