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

Is custom version of yargs still required? #23

Open
gitgrimbo opened this issue Sep 19, 2018 · 0 comments
Open

Is custom version of yargs still required? #23

gitgrimbo opened this issue Sep 19, 2018 · 0 comments

Comments

@gitgrimbo
Copy link

gitgrimbo commented Sep 19, 2018

This project uses a fork of yargs with a config-booleans branch.

"yargs": "git+https://github.com/sgentle/yargs.git#config-booleans"

It looks like the new yargs-parser has changes related to default booleans, and this fork may no longer be required.


Snippet of some of the changes:

https://github.com/sgentle/yargs/blob/7be15b84049f00e6a0c11827c5b16496aeaddd19/lib/parser.js#L316..L344

    Object.keys(flags.configs).forEach(function (configKey) {
...
            // setting arguments via CLI takes precedence over
            // values within the config file.
            if (argv[key] === undefined || (flags.defaulted[key])) {
              delete argv[key]
              setArg(key, config[key])
            }
          })
        } catch (ex) {
          if (argv[configKey]) error = Error(__('invalid json config file: %s', configPath))
        }
      }
    })
  }

Snippet of some of current yargs-parser code:

https://github.com/yargs/yargs-parser/blob/82f4ea5810ca36dbe934de593eb0d45cdcc724c2/index.js#L498..L519

    Object.keys(config).forEach(function (key) {
...
        // setting arguments via CLI takes precedence over
        // values within the config file.
        if (!hasKey(argv, fullKey.split('.')) || (flags.defaulted[fullKey]) || (flags.arrays[fullKey] && configuration['combine-arrays'])) {
          setArg(fullKey, value)
        }
      }
    })
  }
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

1 participant