Skip to content

Is custom version of yargs still required? #23

@gitgrimbo

Description

@gitgrimbo

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)
        }
      }
    })
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions