23 lines
919 B
TypeScript
23 lines
919 B
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 registerRestartCommand(smartcli: plugins.smartcli.Smartcli) {
|
|
registerIpcCommand(smartcli, 'restart', async (argvArg: CliArguments) => {
|
|
const id = argvArg._[1];
|
|
if (!id) {
|
|
console.error('Error: Please provide a process ID');
|
|
console.log('Usage: tspm restart <id>');
|
|
return;
|
|
}
|
|
|
|
console.log(`Restarting process: ${id}`);
|
|
const response = await tspmIpcClient.request('restart', { id });
|
|
|
|
console.log(`✓ Process restarted successfully`);
|
|
console.log(` ID: ${response.processId}`);
|
|
console.log(` PID: ${response.pid || 'N/A'}`);
|
|
console.log(` Status: ${response.status}`);
|
|
}, { actionLabel: 'restart process' });
|
|
} |