feat(cli): Add support for restarting all processes from CLI; improve usage message and reporting
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## 2025-08-29 - 4.1.0 - feat(cli)
|
||||
Add support for restarting all processes from CLI; improve usage message and reporting
|
||||
|
||||
- CLI 'restart' command now accepts 'all' to restart all processes via the daemon (tspm restart all).
|
||||
- Improved usage/help output when no process id is provided.
|
||||
- CLI now prints summaries of restarted process IDs and failed restarts and sets a non-zero exit code when any restarts failed.
|
||||
|
||||
## 2025-08-29 - 4.0.0 - BREAKING CHANGE(cli)
|
||||
Add persistent process registration (tspm add), alias remove, and change start to use saved process IDs (breaking CLI behavior)
|
||||
|
||||
|
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@git.zone/tspm',
|
||||
version: '4.0.0',
|
||||
version: '4.1.0',
|
||||
description: 'a no fuzz process manager'
|
||||
}
|
||||
|
@@ -8,13 +8,31 @@ export function registerRestartCommand(smartcli: plugins.smartcli.Smartcli) {
|
||||
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>');
|
||||
const arg = argvArg._[1];
|
||||
if (!arg) {
|
||||
console.error('Error: Please provide a process ID or "all"');
|
||||
console.log('Usage:');
|
||||
console.log(' tspm restart <id>');
|
||||
console.log(' tspm restart all');
|
||||
return;
|
||||
}
|
||||
|
||||
if (String(arg).toLowerCase() === 'all') {
|
||||
console.log('Restarting all processes...');
|
||||
const res = await tspmIpcClient.request('restartAll', {});
|
||||
if (res.restarted.length > 0) {
|
||||
console.log(`✓ Restarted ${res.restarted.length} processes:`);
|
||||
for (const id of res.restarted) console.log(` - ${id}`);
|
||||
}
|
||||
if (res.failed.length > 0) {
|
||||
console.log(`✗ Failed to restart ${res.failed.length} processes:`);
|
||||
for (const f of res.failed) console.log(` - ${f.id}: ${f.error}`);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const id = String(arg);
|
||||
console.log(`Restarting process: ${id}`);
|
||||
const response = await tspmIpcClient.request('restart', { id });
|
||||
|
||||
|
Reference in New Issue
Block a user