docs: def get_all_choices(completed_args, cur, quoted):
      """
      This is the main completion function.
      Inputs:
      - completed_args: a list of already-completed arguments
      - cur: the current "word in progress" or None
      - quoted: is cur part of a quoted string?
      """
      ctx = get_completion_context(completed_args)
      if not ctx:
          return []
  
      # matching rules, so we can toggle by type and such
      def match_with_case(n, m):
          """case matters"""
          return n.startswith(m)
  
      def match_nocase(n, m):
          """case doesn't matter"""
          return n.lower().startswith(m.lower())
  
      match_func = match_with_case
  
      ctx_options = [
          p for p in ctx.command.get_params(ctx) if isinstance(p, click.Option)
      ]
  
      last_completed = None
      if completed_args:
          last_completed = completed_args[-1]
  
      # if the last completed argument matches a Choice option, we're going to
      # have to expand cur as a choice param
      matching_choice_opt = None
      for p in ctx_options:
          if isinstance(p.type, click.Choice) and last_completed in p.opts:
              matching_choice_opt = p
  
      choices = []
      # if we ended on a choice, complete with all of the available values
      if matching_choice_opt:
          # catch the case where it's case insensitive, and we need to change our
          # comparisons / matching later on
          if isinstance(matching_choice_opt.type, CaseInsensitiveChoice):
              match_func = match_nocase
          choices = [
              (x, matching_choice_opt.help) for x in matching_choice_opt.type.choices
          ]
      # if cur looks like an option, just look for options
      # but skip if it's quoted text
      elif cur and cur.startswith("-") and not quoted:
          for param in ctx_options:
              # skip hidden options
              if isinstance(param, HiddenOption):
                  continue
              for optset in (param.opts, param.secondary_opts):
                  for opt in optset:
                      # only add long-opts, never short opts to completion,
                      # unless the cur appears to be a short opt already
                      if opt.startswith("--") or (len(cur) > 1 and cur[1] != "-"):
                          choices.append((opt, param.help))
      # and if it's a multicommand we see, get the list of subcommands
      elif isinstance(ctx.command, click.MultiCommand) and not quoted:
          choices = [
              (cmdname, ctx.command.get_command(ctx, cmdname).short_help)
              for cmdname in ctx.command.list_commands(ctx)
          ]
      else:
          pass
  
      # now, do final filtering
      if cur:
          choices = [(n, h) for (n, h) in choices if match_func(n, cur)]
  
      return choices