docs: function parse(argv) {
    if (Array.isArray(argv)) {
      argv = argv.join(" ");
    }
  
    var opts = {};
    var paramStr = argv.replace(/(-{1,2}\S+?)\s+((?!-)[\S]+)/g, function(pair){
      var match = pair.match(/-{1,2}(\S+?)\s+((?!-)[\S]+)/);
      var key = match[1], value = match[2];
      try {
        value = JSON.parse(value);
      } catch (error) {}
  
      val(opts, key, value);
      return '';
    });
  
    var flags = {};
    var params = paramStr.split(' ').filter(function(param) {
      if (param == '') return false;
      if (param.search(/^-/) == 0) {
        param = param.replace(/^-{1,2}/, '');
        val(flags, param, true);
        return false;
      }
      return true;
  
    }).map(function(str) {
      try {
        return JSON.parse(str);
      } catch(error) {
        return str;
      }
    });
  
    return { opts: opts, params: params, flags: flags };
  }