Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix string option parsing with nopt v9 - #11019

#11019
Open
2005rishabh wants to merge 1 commit into
ember-cli:noptember-cli/ember-cli:noptfrom
2005rishabh:nopt-v9-fix2005rishabh/ember-cli:nopt-v9-fixCopy head branch name to clipboard
Open

Fix string option parsing with nopt v9#11019
2005rishabh wants to merge 1 commit into
ember-cli:noptember-cli/ember-cli:noptfrom
2005rishabh:nopt-v9-fix2005rishabh/ember-cli:nopt-v9-fixCopy head branch name to clipboard

Conversation

@2005rishabh

Copy link
Copy Markdown

This builds on top of the existing nopt@9 upgrade branch.

nopt@9 treats string option values beginning with -- as additional flags instead of string values, which breaks cases like:

--options "--split 2 --random"

This patch adds a small compatibility layer in parseArgs() that temporarily masks string option values beginning with -- during parsing and restores them afterward.

Verified locally with:

  • tests/unit/models/command-test.js
  • relevant acceptance tests (ember new uses yarn when blueprint has yarn.lock)

Current local result:

  • 173 passing
  • 0 failing

@mansona

mansona commented May 10, 2026

Copy link
Copy Markdown
Member

I haven't looked into this totally yet but the amount of change seems way overkill 🤔 was there any upgrade guide for nopt that suggested the kind of changes that we might need to do?

@2005rishabh

Copy link
Copy Markdown
Author

I couldn't find any upgrade or migration notes from nopt that covered this specific behavior change.

While debugging locally, it looked like nopt v9 was treating string option values that start with -- as additional flags instead of plain string values. That was breaking cases like:

--options "--split 2 --random"

The masking/unmasking approach was my attempt to preserve the existing ember-cli behavior without changing the current command APIs or option definitions.

I do agree the patch ended up being a bit heavier than I'd ideally like though. If there's a cleaner way to handle this with nopt v9, I'm definitely happy to rework or simplify it.

@mansona

mansona commented May 11, 2026

Copy link
Copy Markdown
Member

I noticed yesterday in @bertdeblock 's PR that attempted the same thing he actually removed the test as it could be wrong 🤷 #10907

any thoughts?

@bertdeblock

Copy link
Copy Markdown
Member

I think the better fix is doing what's mentioned in ember-cli/ember-exam#84 (comment), and avoid any additional "parsing" ourselves.

@2005rishabh

Copy link
Copy Markdown
Author

That context helps, thanks.

While debugging, it still looked like nopt@9 was treating string values starting with -- as extra flags, which is why I tried the masking approach to keep the existing ember-cli behavior working.

But I agree the fix ended up being heavier than ideal 😅

I’ll read through the ember-exam discussion more carefully and see if there’s a simpler way to handle this without adding extra parsing logic in ember-cli.

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.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.