_             = require("lodash")
minimist      = require("minimist")

whitelist = "remoteDebugging remoteDebuggingPort url version display devTools".split(" ")

module.exports = (argv = []) ->
  options = minimist(argv, {
    boolean: true
    default: {
      remoteDebugging: true       ## whether to enable remote-debugging
      remoteDebuggingPort: 2220   ## the remote debugging port
      url: null                   ## url to visit on open
      version: false              ## whether to exit + display version
      display: false              ## whether to display the chromium window
      devTools: false             ## whether to pop open the dev tools in main window
    }
    alias: {
      "remote-debugging":      "remoteDebugging"
      "remote-debugging-port": "remoteDebuggingPort"
      "dev-tools":             "devTools"
    }
  })

  _.pick(options, whitelist...)