code: func Print(ctx context.Context, dockerCli command.Cli, tasks []swarm.Task, resolver *idresolver.IDResolver, trunc, quiet bool, format string) error {
  	sort.Stable(tasksBySlot(tasks))
  
  	names := map[string]string{}
  	nodes := map[string]string{}
  
  	tasksCtx := formatter.Context{
  		Output: dockerCli.Out(),
  		Format: NewTaskFormat(format, quiet),
  		Trunc:  trunc,
  	}
  
  	prevName := ""
  	for _, task := range tasks {
  		serviceName, err := resolver.Resolve(ctx, swarm.Service{}, task.ServiceID)
  		if err != nil {
  			return err
  		}
  
  		nodeValue, err := resolver.Resolve(ctx, swarm.Node{}, task.NodeID)
  		if err != nil {
  			return err
  		}
  
  		var name string
  		if task.Slot != 0 {
  			name = fmt.Sprintf("%v.%v", serviceName, task.Slot)
  		} else {
  			name = fmt.Sprintf("%v.%v", serviceName, task.NodeID)
  		}
  
  		// Indent the name if necessary
  		indentedName := name
  		if name == prevName {
  			indentedName = fmt.Sprintf(" \\_ %s", indentedName)
  		}
  		prevName = name
  
  		names[task.ID] = name
  		if tasksCtx.Format.IsTable() {
  			names[task.ID] = indentedName
  		}
  		nodes[task.ID] = nodeValue
  	}
  
  	return FormatWrite(tasksCtx, tasks, names, nodes)
  }
docs: // Print task information in a format.
  // Besides this, command `docker node ps <node>`
  // and `docker stack ps` will call this, too.