code: def _generate_nodes(self,
                          name,
                          command,
                          parent=None,
                          show_nested=False,
                          commands=None):
          
          ctx = click.Context(command, info_name=name, parent=parent)
  
          # Title
  
          section = nodes.section(
              '',
              nodes.title(text=name),
              ids=[nodes.make_id(ctx.command_path)],
              names=[nodes.fully_normalize_name(ctx.command_path)])
  
          # Summary
  
          source_name = ctx.command_path
          result = statemachine.ViewList()
  
          lines = _format_command(ctx, show_nested, commands)
          for line in lines:
              LOG.debug(line)
              result.append(line, source_name)
  
          self.state.nested_parse(result, 0, section)
  
          # Subcommands
  
          if show_nested:
              commands = _filter_commands(ctx, commands)
              for command in commands:
                  section.extend(
                      self._generate_nodes(command.name, command, ctx,
                                           show_nested))
  
          return [section]
docs: Generate the relevant Sphinx nodes.
  
          Format a `click.Group` or `click.Command`.
  
          :param name: Name of command, as used on the command line
          :param command: Instance of `click.Group` or `click.Command`
          :param parent: Instance of `click.Context`, or None
          :param show_nested: Whether subcommands should be included in output
          :param commands: Display only listed commands or skip the section if
              empty
          :returns: A list of nested docutil nodes