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

Behavior of short with value including equals #126

Open
bcoe opened this issue May 26, 2022 · 2 comments
Open

Behavior of short with value including equals #126

bcoe opened this issue May 26, 2022 · 2 comments
Labels
question Further information is requested

Comments

@bcoe
Copy link
Collaborator

bcoe commented May 26, 2022

I found the behavior of -a=5 surprising (I was assuming it would simply be the value "5").

test('when combine string short with value including equals then parsed with equals in value', (t) => {
  const args = ['-a=5'];
  const options = { alpha: { short: 'a', type: 'string' } };
  const expected = { values: { __proto__: null, alpha: '=5' }, positionals: [] };

  const result = parseArgs({ args, options });

  t.deepEqual(result, expected);
  t.end();
});

Can someone refresh me on how we landed on this behavior?

@bcoe bcoe added the question Further information is requested label May 26, 2022
@bakkot
Copy link
Collaborator

bakkot commented May 26, 2022

See #78. Most programs don't support = here; try, for example, grep -C=3 'foo'.

(That said, it might make sense for this to be an error, at least in strict: true, with a suggestion to do -C =3 if that's what you actually meant.)

@shadowspawn
Copy link
Collaborator

(Or support both, per #78. Thanks for supplying the previous issue @bakkot.)

@shadowspawn shadowspawn removed their assignment May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants