docs: function registerUnknownCommands (cli, options) {
    cli.on('command:*', async () => {
      const { args, options: commandoptions } = cli
  
      logger.debug('global_options', options)
      logger.debug('cli_options', commandoptions)
      logger.debug('cli_args', args)
  
      const [commandName] = args
      const sourceDir = args[1] ? path.resolve(args[1]) : pwd
      const inferredUserDocsDirectory = await inferUserDocsDirectory(pwd)
      logger.developer('inferredUserDocsDirectory', inferredUserDocsDirectory)
      logger.developer('sourceDir', sourceDir)
  
      if (inferredUserDocsDirectory && sourceDir !== inferredUserDocsDirectory) {
        logUnknownCommand(cli)
        console.log()
        logger.tip(`Did you miss to specify the target docs dir? e.g. ${chalk.cyan(`vuepress ${commandName} [targetDir]`)}.`)
        logger.tip(`A custom command registered by a plugin requires VuePress to locate your site configuration like ${chalk.cyan('vuepress dev')} or ${chalk.cyan('vuepress build')}.`)
        console.log()
        process.exit(1)
      }
  
      if (!inferredUserDocsDirectory) {
        logUnknownCommand(cli)
        process.exit(1)
      }
  
      logger.debug('Custom command', chalk.cyan(commandName))
      CLI({
        async beforeParse (subCli) {
          const app = createApp({
            sourceDir: sourceDir,
            ...options,
            ...commandoptions
          })
          await app.process()
          app.pluginAPI.applySyncOption('extendCli', subCli, app)
          console.log()
        },
        async afterParse (subCli) {
          if (!subCli.matchedCommand) {
            logUnknownCommand(subCli)
            console.log()
          }
        }
      })
    })
  }