From 6b0ec458e8ef88a1439b548c629c07b44d46dee2 Mon Sep 17 00:00:00 2001 From: Shrey Paharia Date: Thu, 24 Apr 2025 00:27:25 +0530 Subject: [PATCH] feat: add handling for report path override --- scripts/modules/commands.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/scripts/modules/commands.js b/scripts/modules/commands.js index 9e42e42f..38f83a08 100644 --- a/scripts/modules/commands.js +++ b/scripts/modules/commands.js @@ -596,10 +596,16 @@ function registerCommands(programInstance) { .command('list') .description('List all tasks') .option('-f, --file ', 'Path to the tasks file', 'tasks/tasks.json') + .option( + '-r, --report ', + 'Path to the complexity report file', + 'scripts/task-complexity-report.json' + ) .option('-s, --status ', 'Filter by status') .option('--with-subtasks', 'Show subtasks for each task') .action(async (options) => { const tasksPath = options.file; + const reportPath = options.report; const statusFilter = options.status; const withSubtasks = options.withSubtasks || false; @@ -611,7 +617,7 @@ function registerCommands(programInstance) { console.log(chalk.blue('Including subtasks in listing')); } - await listTasks(tasksPath, statusFilter, withSubtasks); + await listTasks(tasksPath, statusFilter, reportPath, withSubtasks); }); // expand command @@ -914,9 +920,15 @@ function registerCommands(programInstance) { `Show the next task to work on based on dependencies and status${chalk.reset('')}` ) .option('-f, --file ', 'Path to the tasks file', 'tasks/tasks.json') + .option( + '-r, --report ', + 'Path to the complexity report file', + 'scripts/task-complexity-report.json' + ) .action(async (options) => { const tasksPath = options.file; - await displayNextTask(tasksPath); + const reportPath = options.report; + await displayNextTask(tasksPath, reportPath); }); // show command @@ -928,6 +940,11 @@ function registerCommands(programInstance) { .argument('[id]', 'Task ID to show') .option('-i, --id ', 'Task ID to show') .option('-f, --file ', 'Path to the tasks file', 'tasks/tasks.json') + .option( + '-r, --report ', + 'Path to the complexity report file', + 'scripts/task-complexity-report.json' + ) .action(async (taskId, options) => { const idArg = taskId || options.id; @@ -937,7 +954,8 @@ function registerCommands(programInstance) { } const tasksPath = options.file; - await displayTaskById(tasksPath, idArg); + const reportPath = options.report; + await displayTaskById(tasksPath, idArg, reportPath); }); // add-dependency command