From baf5bdb8038b07bc3059e5674ba226217069603c Mon Sep 17 00:00:00 2001 From: Petru Paler Date: Sat, 7 Feb 2026 15:15:58 +0000 Subject: [PATCH] fix: resolve --format option conflict between global and export subcommand The global --format option (json/table/text output formatting) shadows the export subcommand's --format option (csv/xlsx/pdf export format), causing Commander.js to consume the flag at the root level and leaving the export command's required --format unsatisfied. Fix by enabling positional options on the root program and pass-through options on the drive command group, so Commander.js stops parsing parent options once it encounters a subcommand name. --- src/commands/drive.ts | 4 +++- src/index.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/commands/drive.ts b/src/commands/drive.ts index 2dc8f61..062de1b 100644 --- a/src/commands/drive.ts +++ b/src/commands/drive.ts @@ -30,7 +30,9 @@ interface DriveExportOptions { export function registerDriveCommands(program: Command): void { const drive = program .command('drive') - .description('Manage Google Drive files (read-only)'); + .description('Manage Google Drive files (read-only)') + .enablePositionalOptions() + .passThroughOptions(); // drive list drive diff --git a/src/index.ts b/src/index.ts index dd4374c..4f8f123 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,6 +12,7 @@ program .name('gwcli') .description('Google Workspace CLI - Manage Gmail, Calendar, and Drive with multi-profile support') .version('0.1.0') + .enablePositionalOptions() .option('-p, --profile ', 'Use a specific profile (overrides GWCLI_PROFILE and default)') .option('-f, --format ', 'Output format: json, table, text', 'table');