LCOV - code coverage report
Current view: top level - include/esys/repo/tui - run_compact_sync_tui.h (source / functions) Hit Total Coverage
Test: esysrepo_coverage.info Lines: 0 2 0.0 %
Date: 2026-08-01 10:43:40 Functions: 0 0 -

          Line data    Source code
       1             : /*!
       2             :  * \file esys/repo/tui/run_compact_sync_tui.h
       3             :  * \brief Run sync work under the Compact FTXUI dashboard
       4             :  *
       5             :  * \cond
       6             :  * __legal_b__
       7             :  *
       8             :  * Copyright (c) 2026 Michel Gillet
       9             :  * Distributed under the MIT License.
      10             :  * (See accompanying file LICENSE.txt or
      11             :  * copy at https://opensource.org/licenses/MIT)
      12             :  *
      13             :  * __legal_e__
      14             :  * \endcond
      15             :  *
      16             :  */
      17             : 
      18             : #pragma once
      19             : 
      20             : #include "esys/repo/esysrepo_defs.h"
      21             : #include "esys/repo/progress/progresssession.h"
      22             : #include "esys/repo/result.h"
      23             : 
      24             : #include <esys/log/logger_if.h>
      25             : 
      26             : #include <cstddef>
      27             : #include <functional>
      28             : #include <memory>
      29             : #include <string>
      30             : #include <vector>
      31             : 
      32             : namespace esys::repo::tui
      33             : {
      34             : 
      35             : //! UI-thread hooks for the background SyncTuiWork callback
      36           0 : struct ESYSREPO_API SyncTuiControl
      37             : {
      38             :     //! Capture logger (console muted); install on Cmd / SyncRepos / git helpers
      39             :     std::shared_ptr<log::Logger_if> logger;
      40             : 
      41             :     //! Footer / phase label (e.g. "Loading manifest…")
      42             :     std::function<void(std::string)> set_phase;
      43             : 
      44             :     //! Rebuild repos/workers after the manifest is known (UI thread)
      45             :     std::function<void(std::vector<std::string> names, std::size_t worker_count)> reset_repos;
      46             : };
      47             : 
      48             : //! Optional knobs for ``run_compact_sync_tui``
      49           0 : struct ESYSREPO_API SyncTuiOptions
      50             : {
      51             :     //! Show a timed on-screen caption (e.g. Tab hint) for recordings
      52             :     bool demo = false;
      53             : 
      54             :     //! How long the demo banner stays visible (milliseconds)
      55             :     int demo_banner_hold_ms = 3000;
      56             : 
      57             :     //! Demo banner caption
      58             :     std::string demo_banner_text = "Press Tab to cycle views";
      59             : };
      60             : 
      61             : //! Sync work invoked on a background thread with a shared progress session
      62             : using SyncTuiWork = std::function<Result(progress::ProgressSession &session, SyncTuiControl &control)>;
      63             : 
      64             : //! Run sync work under a fullscreen Compact RepoSync dashboard
      65             : /*!
      66             :  * Requires ``ESYSREPO_HAVE_TUI``. The caller must ensure stdout is a TTY.
      67             :  * One dashboard covers the whole work callback (bootstrap + sync). Console
      68             :  * stdout is muted; INFO/WARN/ERROR appear in the Output pane.
      69             :  *
      70             :  * \param[in] work runs on a worker thread after the first frame
      71             :  * \param[in] repo_names initial display names (may be empty for early TUI)
      72             :  * \param[in] worker_count UI worker slots (typically ``-j``)
      73             :  * \param[in] logger optional logger to wrap/mute during the UI
      74             :  * \param[in] options demo banner and related knobs
      75             :  * \return result of ``work``, or ``NOT_IMPLEMENTED`` without FTXUI
      76             :  */
      77             : ESYSREPO_API Result run_compact_sync_tui(SyncTuiWork work, const std::vector<std::string> &repo_names,
      78             :                                          std::size_t worker_count,
      79             :                                          std::shared_ptr<log::Logger_if> logger = nullptr,
      80             :                                          const SyncTuiOptions &options = {});
      81             : 
      82             : } // namespace esys::repo::tui

Generated by: LCOV version 1.14