docs: def add_command_option(command, name, doc, is_bool=False):
      """
      Add a custom option to a setup command.
  
      Issues a warning if the option already exists on that command.
  
      Parameters
      ----------
      command : str
          The name of the command as given on the command line
  
      name : str
          The name of the build option
  
      doc : str
          A short description of the option, for the `--help` message
  
      is_bool : bool, optional
          When `True`, the option is a boolean option and doesn't
          require an associated value.
      """
  
      dist = get_dummy_distribution()
      cmdcls = dist.get_command_class(command)
  
      if (hasattr(cmdcls, '_astropy_helpers_options') and
              name in cmdcls._astropy_helpers_options):
          return
  
      attr = name.replace('-', '_')
  
      if hasattr(cmdcls, attr):
          raise RuntimeError(
              '{0!r} already has a {1!r} class attribute, barring {2!r} from '
              'being usable as a custom option name.'.format(cmdcls, attr, name))
  
      for idx, cmd in enumerate(cmdcls.user_options):
          if cmd[0] == name:
              log.warn('Overriding existing {0!r} option '
                       '{1!r}'.format(command, name))
              del cmdcls.user_options[idx]
              if name in cmdcls.boolean_options:
                  cmdcls.boolean_options.remove(name)
              break
  
      cmdcls.user_options.append((name, None, doc))
  
      if is_bool:
          cmdcls.boolean_options.append(name)
  
      # Distutils' command parsing requires that a command object have an
      # attribute with the same name as the option (with '-' replaced with '_')
      # in order for that option to be recognized as valid
      setattr(cmdcls, attr, None)
  
      # This caches the options added through add_command_option so that if it is
      # run multiple times in the same interpreter repeated adds are ignored
      # (this way we can still raise a RuntimeError if a custom option overrides
      # a built-in option)
      if not hasattr(cmdcls, '_astropy_helpers_options'):
          cmdcls._astropy_helpers_options = set([name])
      else:
          cmdcls._astropy_helpers_options.add(name)