cli-options.js 303 B

12345678910111213
  1. /* @flow */
  2. const re = /^dotenv_config_(encoding|path|debug)=(.+)$/
  3. module.exports = function optionMatcher (args /*: Array<string> */) {
  4. return args.reduce(function (acc, cur) {
  5. const matches = cur.match(re)
  6. if (matches) {
  7. acc[matches[1]] = matches[2]
  8. }
  9. return acc
  10. }, {})
  11. }