Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Fix doctests by removing ignore attribute and adding imports

Maximilian Roos349377d120ee
diff --git a/src/styling/constants.rs b/src/styling/constants.rs
index f80216f16..b810171df 100644
--- a/src/styling/constants.rs
+++ b/src/styling/constants.rs
@@ -4,14 +4,15 @@
//!
//! Use `cformat!` with HTML-like tags for all user-facing messages:
//!
-//! ```rust,ignore
+//! ```
//! use color_print::cformat;
//!
//! // Simple styling
-//! cformat!("<green>Success message</>")
+//! let msg = cformat!("<green>Success message</>");
//!
//! // Nested styles - bold inherits green
-//! cformat!("<green>Removed branch <bold>{branch}</> successfully</>")
+//! let branch = "feature";
+//! let msg = cformat!("<green>Removed branch <bold>{branch}</> successfully</>");
//!
//! // Semantic mapping:
//! // - Errors: <red>...</>
@@ -91,8 +92,12 @@ use color_print::cformat;
/// Format an error message with emoji and red styling
///
/// Content can include inner styling like `<bold>`:
-/// ```ignore
-/// error_message(cformat!("Branch <bold>{name}</> not found"))
+/// ```
+/// use color_print::cformat;
+/// use worktrunk::styling::error_message;
+///
+/// let name = "feature";
+/// println!("{}", error_message(cformat!("Branch <bold>{name}</> not found")));
/// ```
pub fn error_message(content: impl AsRef<str>) -> String {
cformat!("{ERROR_EMOJI} <red>{}</>", content.as_ref())
diff --git a/src/styling/format.rs b/src/styling/format.rs
index 364fa538d..5b2648f94 100644
--- a/src/styling/format.rs
+++ b/src/styling/format.rs
@@ -103,9 +103,10 @@ pub(super) fn wrap_text_at_width(text: &str, max_width: usize) -> Vec<String> {
/// This aligns with emoji messages where the emoji (2 columns) + space (1 column) also starts content at column 3.
///
/// # Example
-/// ```ignore
-/// // All contexts use empty left margin and auto-detect width
-/// print!("{}", format_with_gutter(&config, "", None));
+/// ```
+/// use worktrunk::styling::format_with_gutter;
+///
+/// print!("{}", format_with_gutter("hello world", "", Some(80)));
/// ```
pub fn format_with_gutter(content: &str, left_margin: &str, max_width: Option<usize>) -> String {
let gutter = super::GUTTER;
@@ -301,7 +302,9 @@ fn format_bash_with_gutter_impl(
/// misinterpreting `}}` as a command when it appears at line start.
///
/// # Example
-/// ```ignore
+/// ```
+/// use worktrunk::styling::format_bash_with_gutter;
+///
/// print!("{}", format_bash_with_gutter("npm install --frozen-lockfile", ""));
/// ```
#[cfg(feature = "syntax-highlighting")]