pub struct Printer { /* private fields */ }Implementations§
Source§impl Printer
impl Printer
Sourcepub fn new(verbosity: Verbosity) -> Self
pub fn new(verbosity: Verbosity) -> Self
Production constructor: stderr/stdout via console::Term.
pub fn with_theme_name(verbosity: Verbosity, theme_name: Option<&str>) -> Self
pub fn with_format( verbosity: Verbosity, theme_name: Option<&str>, output_format: OutputFormat, ) -> Self
pub fn verbosity(&self) -> Verbosity
pub fn output_format(&self) -> &OutputFormat
pub fn is_structured(&self) -> bool
pub fn is_wide(&self) -> bool
Sourcepub fn disable_colors()
pub fn disable_colors()
Disable color globally (today’s disable_colors).
Sourcepub fn enable_colors()
pub fn enable_colors()
Force color globally regardless of TTY detection. Symmetric to
disable_colors so demo / example binaries that pipe their output for
capture can still emit real ANSI escapes. Production CLI dispatch goes
through with_format, which honors NO_COLOR and structured-output
gating — call this only from non-production entry points.
pub fn heading(&self, text: impl Into<String>)
pub fn kv(&self, key: impl Into<String>, value: impl Into<String>)
pub fn kv_block<I, K, V>(&self, pairs: I)
pub fn hint(&self, text: impl Into<String>)
pub fn note(&self, text: impl Into<String>)
pub fn table(&self, table: Table)
Sourcepub fn status_simple(&self, role: Role, subject: impl Into<String>)
pub fn status_simple(&self, role: Role, subject: impl Into<String>)
Status with no extra fields. For detail/duration/target, use the builder
returned by the binding helper status (see status_builder.rs).
Sourcepub fn status(
&self,
role: Role,
subject: impl Into<String>,
) -> StatusBuilder<'_>
pub fn status( &self, role: Role, subject: impl Into<String>, ) -> StatusBuilder<'_>
Status builder at depth 0. Commits on Drop.
Sourcepub fn spinner(&self, message: impl Into<String>) -> Spinner<'_>
pub fn spinner(&self, message: impl Into<String>) -> Spinner<'_>
Top-level spinner (depth 0). Required for ~14 lib-side call sites
in cfgd-core that today take &Printer and have no section context
(oci/, upgrade/, sources/, modules/git.rs, reconciler/scripts.rs).
pub fn progress_bar( &self, total: u64, message: impl Into<String>, ) -> ProgressBar<'_>
Sourcepub fn multi_progress(&self) -> &MultiProgress
pub fn multi_progress(&self) -> &MultiProgress
Expose the underlying MultiProgress for callers that need fine-grained control (kept for API parity with the old Printer).
Sourcepub fn run(
&self,
cmd: &mut Command,
label: impl Into<String>,
) -> Result<CommandOutput>
pub fn run( &self, cmd: &mut Command, label: impl Into<String>, ) -> Result<CommandOutput>
Run an external command at top-level (depth 0) with live output.
TTY+non-quiet → spinner with tailing ring; otherwise → streaming lines.
Either path captures full stdout/stderr in the returned CommandOutput.
Sourcepub fn flush(&self)
pub fn flush(&self)
Final flush — call at the end of a streaming command to ensure any buffered kvs land. (Drop on Printer would also do this but tests need explicit control.)
Sourcepub fn render(&self, doc: Doc)
pub fn render(&self, doc: Doc)
Force human render of a Doc to stderr, regardless of output_format.
Used by tests; production code should call emit (T24) which routes by
OutputFormat and falls back to this for human formats.
Sourcepub fn emit(&self, doc: Doc)
pub fn emit(&self, doc: Doc)
Routed emit: structured formats go to stdout as JSON/YAML/etc.; Table/Wide
go to stderr as the human render. This is the canonical buffered-output
entry; production callers use this, not render.