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 shortFlag option #39

Merged
merged 7 commits into from
Jun 22, 2019
Merged

Add shortFlag option #39

merged 7 commits into from
Jun 22, 2019

Conversation

tunnckoCore
Copy link

@tunnckoCore tunnckoCore commented Jun 17, 2019

Resolves #32

Let me know if that option name is okay, or if you don't want to have an option at all, which in turn will mean a major bump.

Example

const dargs = require('dargs');

const argv = require('minimist')(process.argv.slice(2));

console.log(dargs(argv, { allowSingleFlags: true }));
// => ['-a=123', '--foo=bar']

// Old behavior and still default one
console.log(dargs(argv));
// => ['--a=123', '--foo=bar']

Signed-off-by: Charlike Mike Reagent <opensource@tunnckocore.com>
@tunnckoCore
Copy link
Author

@sindresorhus 🏓 ❤️

@sindresorhus
Copy link
Owner

I wouldn't use the word allow as it's not really about allowing it. It's more like transforming. And it's more commonly known as a short flag/option, so I think I would make the option just {shortFlag: true}.

@sindresorhus sindresorhus changed the title support single flags Add shortFlag option Jun 20, 2019
@sindresorhus
Copy link
Owner

@tunnckoCore
Copy link
Author

tunnckoCore commented Jun 20, 2019

Cool, thanks. Yea, it wasn't sounding right to me too. I'll update it :)

@tunnckoCore
Copy link
Author

tunnckoCore commented Jun 21, 2019

So, am I understanding you correctly that you want it to be true by default? :)
If we set it to true by default, most of the tests are starting to fail and need edits, which would be a huge noise.

Signed-off-by: Charlike Mike Reagent <opensource@tunnckocore.com>
Signed-off-by: Charlike Mike Reagent <opensource@tunnckocore.com>
@sindresorhus
Copy link
Owner

No, not true by default.

@tunnckoCore
Copy link
Author

Okay, let me know if something more is needed.

@sindresorhus sindresorhus merged commit 60dfa1d into sindresorhus:master Jun 22, 2019
@sindresorhus
Copy link
Owner

Thanks :)

@sindresorhus
Copy link
Owner

FYI, changed my mind: b466efe

@tunnckoCore tunnckoCore deleted the feat/add-single-flag-support branch June 22, 2019 14:02
@tunnckoCore
Copy link
Author

Cool, great! 🎉

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.

No single flag support?
2 participants