code: func (out *progressOutput) WriteProgress(prog progress.Progress) error {
  	var formatted []byte
  	if prog.Message != "" {
  		formatted = out.sf.formatStatus(prog.ID, prog.Message)
  	} else {
  		jsonProgress := jsonmessage.JSONProgress{Current: prog.Current, Total: prog.Total, HideCounts: prog.HideCounts, Units: prog.Units}
  		formatted = out.sf.formatProgress(prog.ID, prog.Action, &jsonProgress, prog.Aux)
  	}
  	_, err := out.out.Write(formatted)
  	if err != nil {
  		return err
  	}
  
  	if out.newLines && prog.LastUpdate {
  		_, err = out.out.Write(out.sf.formatStatus("", ""))
  		return err
  	}
  
  	return nil
  }
docs: // WriteProgress formats progress information from a ProgressReader.