Skip to content
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

Add combineFlagAndOptionalValue #1326

Merged
merged 4 commits into from Aug 11, 2020

Conversation

shadowspawn
Copy link
Collaborator

@shadowspawn shadowspawn commented Aug 8, 2020

Pull Request

Problem

Previous versions of Commander always expanded combined short flags, so -fb always expanded to -f -b. This allowed combining short flags for options with optional values as though they were boolean flags.

The new behaviour is that an option with an optional value and the value can be combined, so -fb effectively expands to -f b.

This is a breaking change for old programs which heavily use optional values without an easy fix.

See: #1203

Solution

Allow choosing between the two behaviours. Not included in the README. (Thinking might instead include in an future extended discussion of issues with optional values, see #1315.)

ChangeLog

Copy link
Collaborator

@abetomo abetomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome

@shadowspawn shadowspawn added the pending release Merged into a branch for a future release, but not released yet label Aug 11, 2020
@shadowspawn shadowspawn added this to the v6.1.0 milestone Aug 11, 2020
@shadowspawn shadowspawn merged commit 84fe0da into tj:develop Aug 11, 2020
@shadowspawn shadowspawn removed the pending release Merged into a branch for a future release, but not released yet label Aug 28, 2020
@shadowspawn
Copy link
Collaborator Author

Released in Commander v6.1
https://github.com/tj/commander.js/releases/tag/v6.1.0

@shadowspawn shadowspawn deleted the feature/treat-optional-as-boolean branch November 22, 2020 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants