-
Notifications
You must be signed in to change notification settings - Fork 515
fix(args): Add backward compatibility for single-dash long options #1856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cfsmp3
merged 2 commits into
CCExtractor:master
from
cfsmp3:fix/issue-1576-legacy-single-dash-options
Dec 20, 2025
Merged
fix(args): Add backward compatibility for single-dash long options #1856
cfsmp3
merged 2 commits into
CCExtractor:master
from
cfsmp3:fix/issue-1576-legacy-single-dash-options
Dec 20, 2025
Conversation
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
…CExtractor#1576) Old versions of ccextractor accepted single-dash long options like -quiet, -stdout, -autoprogram. The new Rust-based argument parser (clap) only accepts double-dash options (--quiet, --stdout, etc.). When users ran scripts with -quiet, clap parsed it as individual short options -q -u -i -e -t and failed with exit code 7. Users with stderr redirected never saw the error, causing silent failures with zero-length output files. This adds a normalize_legacy_option() function that pre-processes arguments before passing them to clap: - Single-dash long options (e.g., -quiet) convert to --quiet - Double-dash options remain unchanged - Short options like -o remain unchanged - Numeric options like -1, -12 remain unchanged Includes 6 unit tests for the new function. Fixes CCExtractor#1576 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Collaborator
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit a0593c6...:
Your PR breaks these cases:
NOTE: The following tests have been failing on the master branch as well as the PR:
Congratulations: Merging this PR would fix the following tests:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
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.
Summary
-quiet(single-dash) instead of--quiet(double-dash) would fail silently with exit code 7 and produce zero-length output filesnormalize_legacy_option()function that pre-processes command-line arguments to convert legacy single-dash long options to double-dash format before passing to clap-oRoot Cause
The Rust-based argument parser (clap) only accepts double-dash long options (
--quiet), but old versions of ccextractor accepted single-dash (-quiet). When clap received-quiet, it parsed it as five individual short options-q -u -i -e -t. Since-qwasn't defined, it failed with exit code 7.Users with scripts that redirected stderr (
> /dev/null 2>&1) never saw the error message, causing the "intermittent" zero-length output described in the issue.Changes
src/rust/src/lib.rs:
normalize_legacy_option()function that converts single-dash long options to double-dashTest Results
-quiet--quiet-stdout-autoprogram-o)-1,-12)All 292 Rust tests pass (286 existing + 6 new).
Test plan
-quietnow works (was failing before)--quietstill works-ostill work-1,-12still workFixes #1576
🤖 Generated with Claude Code