luff 0.2.1

Print files with formatting
Documentation
//! Shared output format types
//!
//! This module contains format-related types that are used across
//! feature boundaries (CLI, WASM, library). It must not depend on
//! any feature-gated crate.

use serde::{Deserialize, Serialize};

/// Output format for file content display
///
/// Controls how file information is rendered. Each format
/// optimizes for different use cases:
/// - Markdown: fenced code blocks with language hints
/// - Tree: Visual directory hierarchy with icons
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
#[cfg_attr(feature = "cli", derive(clap::ValueEnum))]
pub enum OutputFormat {
    /// Render files as Markdown fenced code blocks with language hints
    #[default]
    #[cfg_attr(feature = "cli", value(alias = "md"))]
    Markdown,
    /// Render files as a tree structure with Unicode box-drawing
    Tree,
}

impl std::fmt::Display for OutputFormat {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::Markdown => f.write_str("markdown"),
            Self::Tree => f.write_str("tree"),
        }
    }
}