fix: resolve --format option conflict between global and export subcommand#1
Open
ppetru wants to merge 1 commit into
Open
fix: resolve --format option conflict between global and export subcommand#1ppetru wants to merge 1 commit into
ppetru wants to merge 1 commit into
Conversation
…mmand 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
gwcli drive export <file-id> --format csvfails with:The global
--formatoption (json/table/text output formatting) defined on the root program shadows the export subcommand's--formatoption (csv/xlsx/pdf export format). Commander.js consumes the flag at the root level, leaving the export command's required--formatunsatisfied.Fix
Enable
positionalOptionson the root program andpassThroughOptionson the drive command group. This tells Commander.js to stop parsing parent-level options once it encounters a subcommand, allowing each subcommand to define its own options without conflicts.program.enablePositionalOptions()— root stops consuming options after a subcommand namedrive.enablePositionalOptions().passThroughOptions()— drive passes unrecognized options through to its subcommandsTesting
Before fix:
After fix: