chore: fix formatting issues

This commit is contained in:
Ralph Khreish
2025-04-19 00:09:22 +02:00
parent 3eca720f36
commit 8840d2fb3b

View File

@@ -1404,12 +1404,18 @@ function registerCommands(programInstance) {
}
// Split task IDs if comma-separated
const taskIdArray = taskIds.split(',').map(id => id.trim());
const taskIdArray = taskIds.split(',').map((id) => id.trim());
// Validate all task IDs exist before proceeding
const invalidTasks = taskIdArray.filter(id => !taskExists(data.tasks, id));
const invalidTasks = taskIdArray.filter(
(id) => !taskExists(data.tasks, id)
);
if (invalidTasks.length > 0) {
console.error(chalk.red(`Error: The following tasks were not found: ${invalidTasks.join(', ')}`));
console.error(
chalk.red(
`Error: The following tasks were not found: ${invalidTasks.join(', ')}`
)
);
process.exit(1);
}
@@ -1452,7 +1458,8 @@ function registerCommands(programInstance) {
// Show if other tasks depend on it
const dependentTasks = data.tasks.filter(
(t) =>
t.dependencies && t.dependencies.includes(parseInt(taskId, 10))
t.dependencies &&
t.dependencies.includes(parseInt(taskId, 10))
);
if (dependentTasks.length > 0) {
@@ -1461,7 +1468,9 @@ function registerCommands(programInstance) {
`⚠️ Warning: ${dependentTasks.length} other tasks depend on this task!`
)
);
console.log(chalk.yellow('These dependencies will be removed:'));
console.log(
chalk.yellow('These dependencies will be removed:')
);
dependentTasks.forEach((t) => {
console.log(chalk.yellow(` - Task ${t.id}: ${t.title}`));
});
@@ -1504,8 +1513,8 @@ function registerCommands(programInstance) {
stopLoadingIndicator(indicator);
// Display results
const successfulRemovals = results.filter(r => r.success);
const failedRemovals = results.filter(r => !r.success);
const successfulRemovals = results.filter((r) => r.success);
const failedRemovals = results.filter((r) => !r.success);
if (successfulRemovals.length > 0) {
console.log(
@@ -1514,9 +1523,13 @@ function registerCommands(programInstance) {
`Successfully removed ${successfulRemovals.length} task${successfulRemovals.length > 1 ? 's' : ''}`
) +
'\n\n' +
successfulRemovals.map(r =>
chalk.white(`${r.taskId.includes('.') ? 'Subtask' : 'Task'} ${r.taskId}`)
).join('\n'),
successfulRemovals
.map((r) =>
chalk.white(
`${r.taskId.includes('.') ? 'Subtask' : 'Task'} ${r.taskId}`
)
)
.join('\n'),
{
padding: 1,
borderColor: 'green',
@@ -1534,9 +1547,9 @@ function registerCommands(programInstance) {
`Failed to remove ${failedRemovals.length} task${failedRemovals.length > 1 ? 's' : ''}`
) +
'\n\n' +
failedRemovals.map(r =>
chalk.white(`${r.taskId}: ${r.error}`)
).join('\n'),
failedRemovals
.map((r) => chalk.white(`${r.taskId}: ${r.error}`))
.join('\n'),
{
padding: 1,
borderColor: 'red',