luhcore

Crates.ioluhcore
lib.rsluhcore
version0.0.1
created_at2025-11-12 02:21:40.320618+00
updated_at2025-11-12 02:21:40.320618+00
descriptionthe core library for the luh ecosystem
homepage
repositoryhttps://github.com/calizoots/luhcore
max_upload_size
id1928691
size63,276
s (calizoots)

documentation

README

luhcore

luhcore is a small utility crate providing core functionality commonly needed in my applications, including:

  • Terminal styling via [Colorise], [Style], [StyledText], and [Color].
  • Platform directories handling via [dirs::AppDirs].
  • Build and environment checks like is_ci(), is_debug_build(), and is_release_build().

Modules

  • [color]: Extension trait for coloring strings and styled text.
  • [style]: Core style types (Style, StyledText, Color) and styling logic.
  • [dirs]: Application directories handling (AppDirs) for config, cache, temp files, etc.

Features

  • Terminal text styling
    Apply foreground/background colors, bold, underline, and dim effects using a convenient trait interface.

  • Environment detection
    Check if running in a CI environment, or whether the build is a debug or release build.

  • Cross-platform directories
    Create and manage app-specific config, cache, and temporary directories, including development temp files.

Examples

Terminal styling

use luhcore::Colorise;

println!("{}", "error".red().bold());
println!("{}", "warning".yellow().underline());
println!("{}", "success".green().on_white().dim());

Environment detection

use luhcore::{is_ci, is_debug_build};

if is_ci() {
    println!("Running in CI environment");
}
if is_debug_build() {
    println!("Running in debug mode");
}

Directories handling

use luhcore::dirs::AppDirs;

fn main() -> std::io::Result<()> {
    let dirs = AppDirs::for_app("luhcore")?;
    dirs.ensure_all()?;

    println!("Config dir: {}", dirs.config.display());
    println!("Cache dir:  {}", dirs.cache.display());
    println!("Temp dir:   {}", dirs.temp.display());

    let temp_file = dirs.dev_temp_file("example.txt");
    println!("Development temp file path: {}", temp_file.display());

    Ok(())
}

Note

made with love s.c 2025 :)

Commit count: 0

cargo fmt