print_file_list Subroutine

public subroutine print_file_list(files, w)

Print the computed watch list (limited output).

The printed list is capped to avoid overwhelming the terminal.

Verbosity rules

  • Printed only when w%verbosity >= 2.
  • Returns immediately if files is not allocated.

Arguments

  • files: Computed list of watched file paths.
  • w: Watcher options (controls whether printing is enabled).

Arguments

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

Calls

proc~~print_file_list~~CallsGraph proc~print_file_list print_file_list colorize colorize proc~print_file_list->colorize str str proc~print_file_list->str

Called by

proc~~print_file_list~~CalledByGraph proc~print_file_list print_file_list proc~rebuild_watch_list rebuild_watch_list proc~rebuild_watch_list->proc~print_file_list proc~handle_manifest_change handle_manifest_change proc~handle_manifest_change->proc~rebuild_watch_list proc~watcher_init watcher_t%watcher_init proc~watcher_init->proc~rebuild_watch_list proc~watcher_run watcher_t%watcher_run proc~watcher_run->proc~rebuild_watch_list proc~watcher_run->proc~handle_manifest_change

Source Code

   subroutine print_file_list(files, w)
      type(string_t), allocatable, intent(in) :: files(:)
      type(watch_opts_t), intent(in) :: w
      integer :: i, cap
      character(len=:), allocatable :: pfx

      if (w%verbosity < 2) return
      if (.not. allocated(files)) return

      cap = 200
      pfx = colorize("fpm-watch info:", color_fg='blue_intense', style='bold_on')

      write(output_unit,'(a)') &
         pfx // " watched files list (cap=200), n=" // &
         colorize(str(size(files)), color_fg='yellow_intense', style='bold_on')

      do i = 1, min(size(files), cap)
         write(output_unit,'(a)') pfx // "   " // colorize(trim(files(i)%s), color_fg='white_intense')
      end do

      if (size(files) > cap) then
         write(output_unit,'(a)') &
            pfx // "   ... (" // colorize(str(size(files)-cap), color_fg='yellow') // " more)"
      end if
   end subroutine print_file_list