cli-options.js 385 B

1234567891011121314151617
  1. const re = /^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/
  2. module.exports = function optionMatcher (args) {
  3. const options = args.reduce(function (acc, cur) {
  4. const matches = cur.match(re)
  5. if (matches) {
  6. acc[matches[1]] = matches[2]
  7. }
  8. return acc
  9. }, {})
  10. if (!('quiet' in options)) {
  11. options.quiet = 'true'
  12. }
  13. return options
  14. }