termcinema-cli 0.1.0

🎬 Animated terminal-to-SVG renderer CLI for the termcinema project
Documentation
use std::fs;

/// Warn if the generated SVG file is too large (default threshold: 1MB).
///
/// This check helps avoid excessive SVG sizes that may lag or fail to load in browsers.
///
/// - `path`: Path to the generated SVG file
/// - `limit`: Maximum allowed file size in bytes
///
/// If the size exceeds the limit, a warning is printed suggesting the use of `--script` mode.
pub(crate) fn warn_if_svg_too_large(path: &str, limit: u64) {
    if let Ok(meta) = fs::metadata(path) {
        let size = meta.len();
        if size > limit {
            eprintln!(
                "⚠️ SVG file size is {:.2}MB, which may cause lag or load failures in browsers.\n\
👉 Consider structuring your content as a prompt-based script using `--script` to reduce animation frames.",
                size as f64 / (1024.0 * 1024.0)
            );
        }
    }
}