code: function serializeOptions(schema, options) {
    return Object.keys(schema).reduce((newOptions, option) => {
      const paramValue = options[option];
      if (paramValue === undefined) {
        return newOptions;
      }
  
      const paramType = schema[option].type;
      const paramName = schema[option].param;
  
      if (paramType === 'array') {
        if (!Array.isArray(paramValue)) {
          throw new Error(`${option} should be an array`);
        }
  
        return newOptions.concat(
          paramValue.reduce((acc, value) => acc.concat([paramName, String(value)]), [])
        );
      }
  
      if (paramType === 'boolean') {
        if (typeof paramValue !== 'boolean') {
          throw new Error(`${option} should be a bool`);
        }
  
        const invertedParamName = schema[option].invertedParam;
  
        if (paramValue && paramName !== undefined) {
          return newOptions.concat([paramName]);
        }
  
        if (!paramValue && invertedParamName !== undefined) {
          return newOptions.concat([invertedParamName]);
        }
  
        return newOptions;
      }
  
      return newOptions.concat(paramName, paramValue);
    }, []);
  }
docs: Schema definition for a command.
  @typedef {Object.<string, OptionSchema>} OptionsSchema
   
  Serializes command line options into an arguments array.
  
  @param {OptionsSchema} schema An options schema required by the command.
  @param {object} options An options object according to the schema.
  @returns {string[]} An arguments array that can be passed via command line.