32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import * as plugins from '../../../plugins.js';
|
|
import { tspmIpcClient } from '../../../classes.ipcclient.js';
|
|
import type { CliArguments } from '../../types.js';
|
|
import { registerIpcCommand } from '../../registration/index.js';
|
|
|
|
export function registerStartAllCommand(smartcli: plugins.smartcli.Smartcli) {
|
|
registerIpcCommand(
|
|
smartcli,
|
|
'start-all',
|
|
async (_argvArg: CliArguments) => {
|
|
console.log('Starting all processes...');
|
|
const response = await tspmIpcClient.request('startAll', {});
|
|
|
|
if (response.started.length > 0) {
|
|
console.log(`✓ Started ${response.started.length} processes:`);
|
|
for (const id of response.started) {
|
|
console.log(` - ${id}`);
|
|
}
|
|
}
|
|
|
|
if (response.failed.length > 0) {
|
|
console.log(`✗ Failed to start ${response.failed.length} processes:`);
|
|
for (const failure of response.failed) {
|
|
console.log(` - ${failure.id}: ${failure.error}`);
|
|
}
|
|
process.exitCode = 1; // Signal partial failure
|
|
}
|
|
},
|
|
{ actionLabel: 'start all processes' },
|
|
);
|
|
}
|