30 lines
925 B
TypeScript
30 lines
925 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 registerDeleteCommand(smartcli: plugins.smartcli.Smartcli) {
|
|
registerIpcCommand(
|
|
smartcli,
|
|
'delete',
|
|
async (argvArg: CliArguments) => {
|
|
const id = argvArg._[1];
|
|
if (!id) {
|
|
console.error('Error: Please provide a process ID');
|
|
console.log('Usage: tspm delete <id>');
|
|
return;
|
|
}
|
|
|
|
console.log(`Deleting process: ${id}`);
|
|
const response = await tspmIpcClient.request('delete', { id });
|
|
|
|
if (response.success) {
|
|
console.log(`✓ ${response.message}`);
|
|
} else {
|
|
console.error(`✗ Failed to delete process: ${response.message}`);
|
|
}
|
|
},
|
|
{ actionLabel: 'delete process' },
|
|
);
|
|
}
|