report_changes Subroutine

public subroutine report_changes(files, changed_idx, changed_count, w)

Print a summary of changed files.

The output is intentionally limited (cap=8) to keep logs compact. This routine is suppressed in quiet mode (w%verbosity < 0).

Arguments

Type IntentOptional Attributes Name
type(string_t), intent(in), allocatable :: files(:)
integer, intent(in) :: changed_idx(:)
integer, intent(in) :: changed_count
type(watch_opts_t), intent(in) :: w

Calls

proc~~report_changes~~CallsGraph proc~report_changes report_changes colorize colorize proc~report_changes->colorize proc~ftoa ftoa proc~report_changes->proc~ftoa str str proc~report_changes->str

Called by

proc~~report_changes~~CalledByGraph proc~report_changes report_changes proc~watcher_run watcher_t%watcher_run proc~watcher_run->proc~report_changes

Source Code

   subroutine report_changes(files, changed_idx, changed_count, w)
      type(string_t), allocatable, intent(in) :: files(:)
      integer, intent(in) :: changed_idx(:)
      integer, intent(in) :: changed_count
      type(watch_opts_t), intent(in) :: w
      integer :: i, cap, idx

      if (w%verbosity < 0) return

      cap = 8
      write(output_unit,'(a)') &
         colorize("change     |", color_fg='yellow_intense', style='bold_on') // "  " // &
         colorize(str(changed_count), color_fg='yellow_intense', style='bold_on') // &
         " files (debounced " // colorize(ftoa(w%debounce), color_fg='yellow') // "s)"

      if (changed_count == 0) return
      if (.not. allocated(files)) return

      do i = 1, min(changed_count, cap)
         idx = changed_idx(i)
         if (idx < 1 .or. idx > size(files)) cycle
         write(output_unit,'(a)') "           |  " // colorize(trim(files(idx)%s), color_fg='yellow')
      end do
      if (changed_count > cap) then
         write(output_unit,'(a)') &
            "           |  ... +" // colorize(str(changed_count-cap), color_fg='yellow') // " more"
      end if
   end subroutine report_changes