Skip to content

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

Open
@EstebanMacanek

Description

@EstebanMacanek

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;

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