inherit-core 0.1.4

Core library for [`Inherit`](https://crates.io/crates/cargo-inherit).
Documentation

inherit-core

Core library for cargo-inherit.

Crates.io Documentation License: MIT License: Apache 2.0

The engine behind cargo-inherit: template loading, variable resolution, and project generation. Use this crate to embed Inherit's templating logic into your own tools.

Features

  • Manifest-driven: Inherit.toml declares template metadata, variables, and hooks
  • Variable collection: Automatically scans template files for @VAR@ placeholders
  • Git-aware ignoring: .inherignore support using gitignore-compatible syntax
  • Safe generation: Atomic file operations, validation, and clear error reporting
  • Hook system: Run post-creation commands in the generated project

Quick Start

Add to your dependencies:

cargo add inherit-core

Basic usage:

use inherit_core::{load_template, process_template, ProcessOptions, Variables};
use std::path::Path;

// Load template context (manifest + scanned variables)
let ctx = load_template(Path::new("path/to/template"))?;

// Prepare variable values (e.g., from user input or config)
let mut vars = Variables::new();
vars.insert("PROJECT_NAME".into(), "my_project".into());
// ... fill all required variables ...

// Generate the project
let result = process_template(
    Path::new("path/to/template"),
    Path::new("path/to/output"),
    &vars,
    ProcessOptions::default(),
)?;

println!("Generated {} files", result.processed_files);

Documentation

Full API reference, Inherit.toml specification, and integration guides are available in the book.

License

MIT OR Apache-2.0