29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import * as plugins from '../../plugins.js';
|
|
import { tspmIpcClient } from '../../../client/tspm.ipcclient.js';
|
|
import type { CliArguments } from '../../types.js';
|
|
import { registerIpcCommand } from '../../registration/index.js';
|
|
import { formatMemory, parseMemoryString } from '../../helpers/memory.js';
|
|
|
|
export function registerEditCommand(smartcli: plugins.smartcli.Smartcli) {
|
|
registerIpcCommand(
|
|
smartcli,
|
|
'edit',
|
|
async (argvArg: CliArguments) => {
|
|
const target = argvArg._[1];
|
|
if (!target) {
|
|
console.error('Error: Please provide a process target to edit');
|
|
console.log('Usage: tspm edit <id | id:N | name:LABEL>');
|
|
return;
|
|
}
|
|
|
|
// Resolve the target to get the process ID
|
|
const resolved = await tspmIpcClient.request('resolveTarget', { target: String(target) });
|
|
|
|
// Use the shared interactive edit function
|
|
const { interactiveEditProcess } = await import('../../helpers/interactive-edit.js');
|
|
await interactiveEditProcess(resolved.id);
|
|
},
|
|
{ actionLabel: 'edit process config' },
|
|
);
|
|
}
|