docs: def _click_autocomplete(root, text):
      """Completer generator for click applications."""
      try:
          parts = shlex.split(text)
      except ValueError:
          raise StopIteration
  
      location, incomplete = _click_resolve_command(root, parts)
  
      if not text.endswith(' ') and not incomplete and text:
          raise StopIteration
  
      if incomplete and not incomplete[0:2].isalnum():
          for param in location.params:
              if not isinstance(param, click.Option):
                  continue
              for opt in itertools.chain(param.opts, param.secondary_opts):
                  if opt.startswith(incomplete):
                      yield completion.Completion(opt, -len(incomplete), display_meta=param.help)
  
      elif isinstance(location, (click.MultiCommand, click.core.Group)):
          ctx = click.Context(location)
          commands = location.list_commands(ctx)
          for command in commands:
              if command.startswith(incomplete):
                  cmd = location.get_command(ctx, command)
                  yield completion.Completion(command, -len(incomplete), display_meta=cmd.short_help)