code: func FormatWrite(ctx formatter.Context, tasks []swarm.Task, names map[string]string, nodes map[string]string) error {
  	render := func(format func(subContext formatter.SubContext) error) error {
  		for _, task := range tasks {
  			taskCtx := &taskContext{trunc: ctx.Trunc, task: task, name: names[task.ID], node: nodes[task.ID]}
  			if err := format(taskCtx); err != nil {
  				return err
  			}
  		}
  		return nil
  	}
  	taskCtx := taskContext{}
  	taskCtx.Header = formatter.SubHeaderContext{
  		"ID":           taskIDHeader,
  		"Name":         formatter.NameHeader,
  		"Image":        formatter.ImageHeader,
  		"Node":         nodeHeader,
  		"DesiredState": desiredStateHeader,
  		"CurrentState": currentStateHeader,
  		"Error":        errorHeader,
  		"Ports":        formatter.PortsHeader,
  	}
  	return ctx.Write(&taskCtx, render)
  }
docs: // FormatWrite writes the context