| 101 | } |
| 102 | |
| 103 | function render(action, runResult = null) { |
| 104 | const lines = [ |
| 105 | 'Continue Action', |
| 106 | '='.repeat(40), |
| 107 | `Kind: ${action.kind}`, |
| 108 | `Label: ${action.label}`, |
| 109 | `Command: ${action.command || '(none)'}`, |
| 110 | `Why: ${action.why}`, |
| 111 | `Runbook: ${action.runbook}`, |
| 112 | ]; |
| 113 | if (runResult && runResult.executed) { |
| 114 | lines.push(`Executed: yes`); |
| 115 | lines.push(`Exit Code: ${runResult.status}`); |
| 116 | if (runResult.stdout.trim()) lines.push(runResult.stdout.trim()); |
| 117 | if (runResult.stderr.trim()) lines.push(runResult.stderr.trim()); |
| 118 | } else if (runResult) { |
| 119 | lines.push('Executed: no'); |
| 120 | } |
| 121 | return `${lines.join('\n')}\n`; |
| 122 | } |
| 123 | |
| 124 | function main() { |
| 125 | const args = parseArgs(process.argv.slice(2)); |