Skip to content

findConfigFlag consumes next CLI argument when -c= is passed with an empty value #1571

Closed

Description

@shafiktanbir

Noticed a small edge case in findConfigFlag (packages/cli/src/services/project-cli.ts lines 72-84 on main commit 79f5ef6). For --config=, passing an empty value returns arg.slice('--config='.length) || undefined (undefined) without consuming args[i + 1].

However, in the short-flag branch (if (arg[j] === 'c')), const value = arg.slice(arg[j + 1] === '=' ? j + 2 : j + 1); return (value || args[i + 1]) || undefined falls back to args[i + 1] even when arg[j + 1] === '=' and the value after = is empty, so -c= (or -pc=) treats the next CLI argument or flag as the config file path instead of returning undefined. Should the arg[j + 1] === '=' case return value || undefined directly like --config= does? Happy to open a small PR with a test if you'd like!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions