Crate thag_common

Crate thag_common 

Source
Expand description

Common types, macros, and utilities shared across thag_rs subcrates.

This crate provides the foundational components that multiple thag_rs subcrates depend on, including verbosity control, color support detection, terminal background luminance, utility macros, and common error handling patterns.

Modules§

help_system
Lightweight help system for thag tools

Macros§

auto_help
Macro to automatically extract help from current source file
debug_log
Debugging logger.
help_system
Macro to create a help system - manually specify the source
lazy_static_var
Lazy-static variable generator.
prtln
Ungated print line macro for user messages
re
Lazy-static regular expression generator.
set_verbosity
Convenient macro for setting global verbosity with short syntax.
static_lazy
Creates a lazily-initialized static variable.
vprtln
Verbosity-gated print line macro for user messages

Structs§

ColorSupportIter
An iterator over the variants of ColorSupport
OutputManager
Manages user message output with verbosity control and thread-safe locking
TermBgLumaIter
An iterator over the variants of TermBgLuma
VerbosityIter
An iterator over the variants of Verbosity

Enums§

ColorSupport
An enum to categorise the current terminal’s level of colour support as detected, configured or defaulted.
TermBgLuma
Terminal background luminance detection and specification
ThagCommonError
Error types for thag_common operations
Verbosity
Controls the detail level of user messaging

Statics§

OUTPUT_MANAGER
Global output manager instance protected by a reentrant mutex for thread-safe access

Functions§

debug_timings
Developer method to log method timings.
disentangle
Unescape \n markers to convert a string of raw text to readable lines.
escape_path_for_windows
No-op function for non-Windows platforms.
get_home_dir
Get the user’s home directory as a PathBuf.
get_home_dir_string
Get the user’s home directory as a String.
get_verbosity
Initializes and returns the global verbosity setting.
init_verbosity
Initialize verbosity with a convenient function that handles common patterns.
reassemble
Reassemble an Iterator of lines from the disentangle function to a string of text.
set_global_verbosity
Set the output verbosity for the current execution.
set_verbosity_from_env
Set global verbosity from the THAG_VERBOSITY environment variable.
thousands
Formats a given positive integer with thousands separators (commas).

Type Aliases§

ThagCommonResult
Result type alias for thag_common operations
V
Type alias for Verbosity to provide a shorter name for convenience