script-meditate 0.1.0

Supercharge Cargo scripts with inline structured data/configuration.
Documentation
#[allow(clippy::module_name_repetitions)]
#[doc(hidden)]
pub use serde_yaml;

/// Extracts, parses, and returns the YAML frontmatter.
///
/// # Panics
///
/// Panics if the frontmatter cannot be found or if its contents cannot be parsed.
#[macro_export]
macro_rules! extract_yaml_frontmatter {
    () => {{
        // Works only if this script is not directly in the user's directory
        let source = include_str!(file!());
        let frontmatter = $crate::extract_frontmatter(source, "yaml")
            .expect("script file should contain a YAML frontmatter");
        $crate::serde_yaml::from_str(frontmatter).expect("could not parse the data")
    }};
}