From efce37469bc58eceef46763ba32df1ed45242211 Mon Sep 17 00:00:00 2001 From: Joe Danziger Date: Wed, 14 May 2025 07:12:15 -0400 Subject: [PATCH] Fix duplicate output on CLI help screen (#496) * remove duplication * add changeset * fix formatting --- .changeset/wide-eyes-relax.md | 11 +++++++++++ scripts/modules/commands.js | 14 +------------- 2 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 .changeset/wide-eyes-relax.md diff --git a/.changeset/wide-eyes-relax.md b/.changeset/wide-eyes-relax.md new file mode 100644 index 00000000..1684d1a5 --- /dev/null +++ b/.changeset/wide-eyes-relax.md @@ -0,0 +1,11 @@ +--- +'task-master-ai': patch +--- + +Fix duplicate output on CLI help screen + +- Prevent the Task Master CLI from printing the help screen more than once when using `-h` or `--help`. +- Removed redundant manual event handlers and guards for help output; now only the Commander `.helpInformation` override is used for custom help. +- Simplified logic so that help is only shown once for both "no arguments" and help flag flows. +- Ensures a clean, branded help experience with no repeated content. +- Fixes #339 diff --git a/scripts/modules/commands.js b/scripts/modules/commands.js index 0e60642b..5d62b5e7 100644 --- a/scripts/modules/commands.js +++ b/scripts/modules/commands.js @@ -486,11 +486,6 @@ function registerCommands(programInstance) { process.exit(1); }); - // Default help - programInstance.on('--help', function () { - displayHelp(); - }); - // parse-prd command programInstance .command('parse-prd') @@ -2366,14 +2361,7 @@ function setupCLI() { return 'unknown'; // Default fallback if package.json fails }) .helpOption('-h, --help', 'Display help') - .addHelpCommand(false) // Disable default help command - .on('--help', () => { - displayHelp(); // Use your custom help display instead - }) - .on('-h', () => { - displayHelp(); - process.exit(0); - }); + .addHelpCommand(false); // Disable default help command // Modify the help option to use your custom display programInstance.helpInformation = () => {