print_banner Subroutine

public subroutine print_banner(full_cmdline, settings, w, files, build_secs, roots_count, secs_model, secs_targets, secs_watch)

Print the startup banner and an initialization timing summary.

The banner is a compact summary of the effective configuration and the computed watch set.

Verbosity rules

  • If w%verbosity < 0, this routine returns without printing.
  • If w%debug is enabled, an extra debug line is printed.

Arguments

  • full_cmdline: Full command that will be executed (typically fpm ...).
  • settings: Effective fpm settings used to build the model.
  • w: Watcher options (verbosity, polling, flags shown in banner).
  • files: Computed list of watched file paths (may be unallocated).
  • build_secs: Total init time (seconds).
  • roots_count: Number of root targets included in the watch closure.
  • secs_model, secs_targets, secs_watch: Timing breakdown (seconds).

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: full_cmdline
class(fpm_build_settings), intent(in) :: settings
type(watch_opts_t), intent(in) :: w
type(string_t), intent(in), allocatable :: files(:)
real, intent(in) :: build_secs
integer, intent(in) :: roots_count
real, intent(in) :: secs_model
real, intent(in) :: secs_targets
real, intent(in) :: secs_watch

Calls

proc~~print_banner~~CallsGraph proc~print_banner print_banner colorize colorize proc~print_banner->colorize proc~active_features active_features proc~print_banner->proc~active_features proc~active_profile active_profile proc~print_banner->proc~active_profile proc~command_mode command_mode proc~print_banner->proc~command_mode proc~ftoa ftoa proc~print_banner->proc~ftoa proc~trim_or_default trim_or_default proc~print_banner->proc~trim_or_default str str proc~print_banner->str proc~join_csv join_csv proc~active_features->proc~join_csv proc~active_profile->proc~trim_or_default

Called by

proc~~print_banner~~CalledByGraph proc~print_banner print_banner proc~rebuild_watch_list rebuild_watch_list proc~rebuild_watch_list->proc~print_banner 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_banner(full_cmdline, settings, w, files, build_secs, roots_count, secs_model, secs_targets, secs_watch)
      character(len=*), intent(in) :: full_cmdline
      class(fpm_build_settings), intent(in) :: settings
      type(watch_opts_t), intent(in) :: w
      type(string_t), allocatable, intent(in) :: files(:)
      real, intent(in) :: build_secs
      integer, intent(in) :: roots_count
      real, intent(in) :: secs_model, secs_targets, secs_watch

      integer :: nfiles
      character(len=:), allocatable :: mode
      character(len=:), allocatable :: initrun
      character(len=:), allocatable :: deps
      character(len=:), allocatable :: prune
      character(len=:), allocatable :: lowcpu
      character(len=:), allocatable :: silent
      character(len=:), allocatable :: bdir

      if (w%verbosity < 0) return

      nfiles = 0
      if (allocated(files)) nfiles = size(files)

      mode = command_mode(settings)

      if (w%run_on_start) then
         initrun = "on"
      else
         initrun = "off"
      end if

      if (w%watch_deps) then
         deps = "on"
      else
         deps = "off"
      end if

      if (settings%prune) then
         prune = "on"
      else
         prune = "off"
      end if

      if (w%low_cpu) then
         lowcpu = "on"
      else
         lowcpu = "off"
      end if

      if (w%silent_fpm) then
         silent = "on"
      else
         silent = "off"
      end if

      bdir = trim_or_default(settings%build_dir, "build")

      write(output_unit,'(a)') &
         colorize("fpm-watch", color_fg='cyan_intense', style='bold_on') // &
         "  |  watching: " // colorize(mode, color_fg='yellow_intense', style='bold_on') // &
         "  |  " // colorize("Ctrl+C", color_fg='red_intense', style='bold_on') // " to stop"

      write(output_unit,'(a)') &
         colorize("command    |", color_fg='cyan_intense', style='bold_on') // "  " // &
         colorize(trim(full_cmdline), color_fg='white_intense')

      write(output_unit,'(a)') &
         colorize("build-dir  |", color_fg='cyan_intense', style='bold_on') // "  " // &
         colorize(trim(bdir), color_fg='yellow_intense')

      write(output_unit,'(a)') &
         colorize("options    |", color_fg='cyan_intense', style='bold_on') // &
         "  prune="       // colorize(prune,  color_fg='yellow') // &
         "   deps="       // colorize(deps,   color_fg='yellow') // &
         "   low-cpu="    // colorize(lowcpu, color_fg='yellow') // &
         "   silent-fpm=" // colorize(silent, color_fg='yellow') // &
         "   verbosity="  // colorize(str(w%verbosity), color_fg='yellow')

      write(output_unit,'(a)') &
         colorize("compiler   |", color_fg='cyan_intense', style='bold_on') // "  " // &
         colorize(trim_or_default(settings%compiler, "(auto)"), color_fg='green_intense')

      write(output_unit,'(a)') &
         colorize("profile    |", color_fg='cyan_intense', style='bold_on') // "  " // &
         colorize(active_profile(settings), color_fg='magenta_intense')

      write(output_unit,'(a)') &
         colorize("features   |", color_fg='cyan_intense', style='bold_on') // "  " // &
         colorize(active_features(settings), color_fg='blue_intense')

      write(output_unit,'(a)') &
         colorize("watch      |", color_fg='cyan_intense', style='bold_on') // &
         "  files=" // colorize(str(nfiles), color_fg='yellow_intense', style='bold_on') // &
         "  roots=" // colorize(str(roots_count), color_fg='yellow_intense', style='bold_on') // &
         "  poll=" // colorize(ftoa(w%poll), color_fg='yellow') // "s" // &
         "  debounce=" // colorize(ftoa(w%debounce), color_fg='yellow') // "s" // &
         "  rescan=" // colorize(ftoa(w%rescan), color_fg='yellow') // "s" // &
         "  init-run=" // colorize(initrun, color_fg='yellow')

      write(output_unit,'(a)') &
         colorize("init       |", color_fg='cyan_intense', style='bold_on') // &
         "  model=" // colorize(ftoa(secs_model), color_fg='yellow') // "s" // &
         "  targets=" // colorize(ftoa(secs_targets), color_fg='yellow') // "s" // &
         "  watchlist=" // colorize(ftoa(secs_watch), color_fg='yellow') // "s" // &
         "  total=" // colorize(ftoa(build_secs), color_fg='yellow_intense', style='bold_on') // "s"

      write(output_unit,'(a)') &
         colorize("stop       |", color_fg='cyan_intense', style='bold_on') // &
         "  Ctrl+C or touch " // colorize(".fpm-watch.stop", color_fg='yellow_intense')

      if (w%debug) then
         write(output_unit,'(a)') &
            colorize("debug      |", color_fg='magenta_intense', style='bold_on') // &
            "  debug=on  verbosity=" // colorize(str(w%verbosity), color_fg='magenta_intense')
      end if
   end subroutine print_banner