const publishDoc = require('./doc')

async function publish(type) {
  const publishHandler = {
    doc: publishDoc, // 处理文档生成
  }
  if (Object.prototype.hasOwnProperty.call(publishHandler, type)) {
    await publishHandler[type]()
  }
}

// 发布命令的核心逻辑
async function execPublish(options) {
  Object.keys(options).forEach(async (type) => {
    await publish(type)
  })
}

module.exports = execPublish
