BREAKING CHANGE(cli): Add persistent process registration (tspm add), alias remove, and change start to use saved process IDs (breaking CLI behavior)
This commit is contained in:
@@ -6,24 +6,27 @@ import { registerIpcCommand } from '../../registration/index.js';
|
||||
export function registerDeleteCommand(smartcli: plugins.smartcli.Smartcli) {
|
||||
registerIpcCommand(
|
||||
smartcli,
|
||||
'delete',
|
||||
['delete', 'remove'],
|
||||
async (argvArg: CliArguments) => {
|
||||
const id = argvArg._[1];
|
||||
if (!id) {
|
||||
console.error('Error: Please provide a process ID');
|
||||
console.log('Usage: tspm delete <id>');
|
||||
console.log('Usage: tspm delete <id> | tspm remove <id>');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`Deleting process: ${id}`);
|
||||
const response = await tspmIpcClient.request('delete', { id });
|
||||
// Determine if command was 'remove' to use the new IPC route, otherwise 'delete'
|
||||
const cmd = String(argvArg._[0]);
|
||||
const useRemove = cmd === 'remove';
|
||||
console.log(`${useRemove ? 'Removing' : 'Deleting'} process: ${id}`);
|
||||
const response = await tspmIpcClient.request(useRemove ? 'remove' : 'delete', { id } as any);
|
||||
|
||||
if (response.success) {
|
||||
console.log(`✓ ${response.message}`);
|
||||
console.log(`✓ ${response.message || (useRemove ? 'Removed successfully' : 'Deleted successfully')}`);
|
||||
} else {
|
||||
console.error(`✗ Failed to delete process: ${response.message}`);
|
||||
console.error(`✗ Failed to ${useRemove ? 'remove' : 'delete'} process: ${response.message}`);
|
||||
}
|
||||
},
|
||||
{ actionLabel: 'delete process' },
|
||||
{ actionLabel: 'delete/remove process' },
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user