feat: Allowing preserving double dashes for variadic args (#229) - #417
Merged
Conversation
alcroito
force-pushed
the
preserve_double_dashes
branch
from
January 14, 2026 15:30
921ee18 to
4b3ea15
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #417 +/- ##
==========================================
- Coverage 52.08% 50.08% -2.01%
==========================================
Files 47 47
Lines 5894 6100 +206
Branches 5894 6100 +206
==========================================
- Hits 3070 3055 -15
- Misses 1438 1513 +75
- Partials 1386 1532 +146 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Owner
|
bugbot run |
Previously, all double dash tokens were discarded when parsed. A new `preserve` option has been added to the `double_dash` setting for arguments. When set to `preserve` on a variadic argument, any double dash tokens (`--`) encountered while parsing will be retained as part of the argument's value. Just like for non-preserve behavior, `enable_flags` processing is disabled for preserve behavior as well. That's because any potential common flags like `--verbose` should be captured inside the variadic arg, rather than being treated as flags. Added tests to verify the new behavior. Fixes jdx#229
alcroito
force-pushed
the
preserve_double_dashes
branch
from
January 14, 2026 17:14
4b3ea15 to
f1ac35b
Compare
Owner
|
bugbot run |
Merged
jdx
pushed a commit
that referenced
this pull request
Jan 14, 2026
## [2.12.0](https://github.com/jdx/usage/compare/v2.11.0..v2.12.0) - 2026-01-14 ### 🚀 Features - Allowing preserving double dashes for variadic args by [@alcroito](https://github.com/alcroito) in [#417](#417) ### 📦️ Dependency Updates - replace dependency @tsconfig/node18 with @tsconfig/node20 by [@renovate[bot]](https://github.com/renovate[bot]) in [#411](#411) - update amannn/action-semantic-pull-request action to v6 by [@renovate[bot]](https://github.com/renovate[bot]) in [#412](#412) - replace dependency @tsconfig/node20 with @tsconfig/node22 by [@renovate[bot]](https://github.com/renovate[bot]) in [#415](#415) - update rust crate clap to v4.5.54 by [@renovate[bot]](https://github.com/renovate[bot]) in [#416](#416) ### New Contributors - @alcroito made their first contribution in [#417](#417)
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Jan 17, 2026
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [usage](https://github.com/jdx/usage) | minor | `2.11.0` → `2.12.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>jdx/usage (usage)</summary> ### [`v2.12.0`](https://github.com/jdx/usage/blob/HEAD/CHANGELOG.md#2120---2026-01-14) [Compare Source](jdx/usage@v2.11.0...v2.12.0) ##### 🚀 Features - Allowing preserving double dashes for variadic args by [@​alcroito](https://github.com/alcroito) in [#​417](jdx/usage#417) ##### 📦️ Dependency Updates - replace dependency [@​tsconfig/node18](https://github.com/tsconfig/node18) with [@​tsconfig/node20](https://github.com/tsconfig/node20) by [@​renovate\[bot\]](https://github.com/renovate\[bot]) in [#​411](jdx/usage#411) - update amannn/action-semantic-pull-request action to v6 by [@​renovate\[bot\]](https://github.com/renovate\[bot]) in [#​412](jdx/usage#412) - replace dependency [@​tsconfig/node20](https://github.com/tsconfig/node20) with [@​tsconfig/node22](https://github.com/tsconfig/node22) by [@​renovate\[bot\]](https://github.com/renovate\[bot]) in [#​415](jdx/usage#415) - update rust crate clap to v4.5.54 by [@​renovate\[bot\]](https://github.com/renovate\[bot]) in [#​416](jdx/usage#416) ##### New Contributors - [@​alcroito](https://github.com/alcroito) made their first contribution in [#​417](jdx/usage#417) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi44MS4yIiwidXBkYXRlZEluVmVyIjoiNDIuODEuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->
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.
Previously, all double dash tokens were discarded when parsed.
A new
preserveoption has been added to thedouble_dashsetting for arguments. When set topreserveon a variadic argument, any double dash tokens (--) encountered while parsing will be retained as part of the argument's value.Just like for non-preserve behavior,
enable_flagsprocessing is disabled for preserve behavior as well. That's because any potential common flags like--verboseshould be captured inside the variadic arg, rather than being treated as flags.Added tests to verify the new behavior.
Fixes #229
Note
Introduces a new
double_dashbehavior to retain--tokens in variadic args and updates parsing, spec, and docs accordingly.SpecDoubleDashChoices::Preserveand serializesdouble_dashwhenautomaticorpreserve--always disables flag parsing; when next arg is variadic withdouble_dash=preserve, the--token is kept as an arg valueSpecArgBuilder::double_dash(...)to set behavior programmaticallyarg.mdwithdouble_dash="preserve"example--, multiple args, and edge casesWritten by Cursor Bugbot for commit f1ac35b. This will update automatically on new commits. Configure here.