Skip to content

Conversation

Arpi223
Copy link

@Arpi223 Arpi223 commented Sep 10, 2025

When parsing short flags with equals syntax (e.g., -o=value), the parser was incorrectly including the equals sign in the parsed value, resulting in '=value' instead of 'value'. This was inconsistent with long flag parsing (--option=value) which correctly returned 'value'.

This fix strips the leading equals sign when present, making short and long flag parsing consistent.

This fixes issues in tools like FlutterFire CLI where users expect -i=bundleid to work the same as --ios-bundle-id=bundleid.

Fixes #908

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

When parsing short flags with equals syntax (e.g., -o=value), the
parser was incorrectly including the equals sign in the parsed value,
resulting in '=value' instead of 'value'. This was inconsistent with
long flag parsing (--option=value) which correctly returned 'value'.

This fix strips the leading equals sign when present, making short
and long flag parsing consistent.

This fixes issues in tools like FlutterFire CLI where users expect
-i=bundleid to work the same as --ios-bundle-id=bundleid.
@Arpi223 Arpi223 requested a review from a team as a code owner September 10, 2025 16:42
@davidmorgan
Copy link
Contributor

As commented on the issue--I think this is working as intended.

@natebosch
Copy link
Member

I agree, we should keep the current and documented behavior.

If we were starting today I would argue against the current behavior and for restricting abbreviated arguments to flags instead of options. The most common behavior I'm familiar with is that a single dash can be followed by one or more single character flags. ls -la passes both the -l and -a flags.

I don't think it's worth breaking existing usage, but if it were I would drop the ability to abbreviate options rather than tweak the way the parsing for abbreviated options works.

@natebosch natebosch closed this Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[args] Short flag with equals syntax incorrectly includes equals sign in parsed value
3 participants