// SPDX-License-Identifier: LGPL-3.0-only // SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts® export module Crafter.Build:Progress; import std; export namespace Crafter::Progress { enum class Verbosity { Quiet, Default, Verbose }; void SetVerbosity(Verbosity v); Verbosity GetVerbosity(); // RAII work-unit marker. Construction inflates the running total; destruction // increments completed and (on Default + TTY) redraws the status line. Move // semantics are disabled — keep these as plain stack locals around the work // they count, so the destructor fires when it ends. A job of a JobGroup // gets one from Add(), made when the job is queued, which is what puts // work that has not started yet in the total. class Task { public: explicit Task(std::string label); ~Task(); Task(const Task&) = delete; Task& operator=(const Task&) = delete; Task(Task&&) = delete; Task& operator=(Task&&) = delete; private: std::string label_; }; // Verbose-mode command echo. No-op outside Verbose. void EchoCommand(std::string_view command); // Non-fatal output from a build step that succeeded — compiler and linker // warnings. Erases the status line first so the text doesn't land on top of // it, then writes to stderr. No-op on Quiet. void Diagnostic(std::string_view text); // Erase the in-place status line so subsequent stderr writes (errors, // banners) don't collide with it. No-op when not in TTY-redraw mode. void Clear(); // Print "Built N targets in Xms" (or equivalent) and clear in-place state. // Safe to call multiple times; subsequent calls are no-ops. void Finalize(); }