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

How to treat all arguments with one hyphen and without equal signs as boolean? #75

Closed
EstebanMacanek opened this issue Jan 24, 2025 · 2 comments

Comments

@EstebanMacanek
Copy link

EstebanMacanek commented Jan 24, 2025

According to the README, opts.boolean doesn't work with -f.

This would work, but is there another way that doesn't imply patching?

diff --git a/index.js b/index.js
index 78cafa8..9fda7a1 100644
--- a/index.js
+++ b/index.js
@@ -228,6 +228,7 @@ module.exports = function (args, opts) {
                                        args[i + 1]
                                        && !(/^(-|--)[^-]/).test(args[i + 1])
                                        && !isBooleanKey(key)
+                                       && !flags.allBools
                                ) {
                                        setArg(key, args[i + 1], arg);
                                        i += 1;

@shadowspawn
Copy link
Collaborator

There is not a configuration to change the treatment of automatic short flags.

@EstebanMacanek
Copy link
Author

Do you think a pr adding this option would be

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

No branches or pull requests

2 participants