code: private void printProgress(final ProgressMessage message) {
  
      final String id = message.id();
      Integer line = idsToLines.get(id);
      int diff = 0;
  
      if (line == null) {
        line = idsToLines.size();
        idsToLines.put(id, line);
      } else {
        diff = idsToLines.size() - line;
      }
  
      if (diff > 0) {
        // move cursor up to the line for this image layer
        out.printf("%c[%dA", ESC_CODE, diff);
        // delete entire line
        out.printf("%c[2K\r", ESC_CODE);
      }
  
      // The progress bar graphic is in the 'progress' element. Some messages like "Pulling
      // dependent layers" don't have a progress bar, in which case set to empty string.
      String progress = message.progress();
      if (progress == null) {
        progress = "";
      }
  
      // this will print something like "90b15849fc7e: Downloading [==>] 5.812 MB/117.4 MB 4m12s"
      out.printf("%s: %s %s%n", id, message.status(), progress);
  
      if (diff > 0) {
        // move cursor back down to bottom
        out.printf("%c[%dB", ESC_CODE, diff - 1);
      }
    }
docs: Displays the upload/download status of multiple image layers the same way the docker CLI does.
  The current status of each layer is show on its own line. As the status updated, we move the
  cursor to the correct line, and overwrite the old status with the new one.
  
  @param message the ProgressMessage to parse