Skip to main content

Crate cookcli_core

Crate cookcli_core 

Source
Expand description

Recipe, shopping list, pantry and report operations for Cooklang.

This crate holds the logic behind CookCLI’s commands, with the CLI reduced to argument parsing and output formatting on top of it.

Commands take their input as a RecipeSource or ConfigSource rather than a path, so an editor can pass an unsaved buffer. They return Outcome<T>, which pairs the result with any Diagnostics raised on the way, or a CoreError when no result could be produced.

Re-exports§

pub use context::global_config_path;
pub use context::Context;
pub use context::CONFIG_DIR_ENV;
pub use diagnostic::Diagnostic;
pub use diagnostic::Location;
pub use diagnostic::Severity;
pub use diagnostic::Span;
pub use error::CoreError;
pub use find::is_safe_relative_path;
pub use find::resolve_reference;
pub use outcome::Outcome;
pub use parser::parse_recipe;
pub use parser::parse_recipe_at;
pub use parser::render_report;
pub use parser::PARSER;
pub use source::ConfigSource;
pub use source::RecipeSource;
pub use cooklang;
pub use cooklang_find;

Modules§

context
Resolved configuration for a set of recipe operations.
diagnostic
Structured diagnostics shared by every command.
doctor
The checks behind cook doctor.
error
The public error type.
find
Resolving a recipe name or path to a file on disk, and walking a whole collection of them.
format
Recipe output formatters.
outcome
The result wrapper every command returns.
pantry
cook pantry: what is in stock, and changing it.
parser
Recipe parsing and conversion of cooklang reports into Diagnostics.
recipe
Reading and scaling a single recipe.
report
Rendering a recipe through a Jinja2 template.
search
Full-text recipe search.
shopping_list
Aggregating several recipes into one shopping list.
source
Input sources. Core never touches the filesystem unless handed a path.

Enums§

PaperSize
Page size for the latex and typst formatters.
Style
Whether formatters emit ANSI escape codes.

Constants§

REFERENCE_SEPARATOR
Re-exported from cooklang_format, which is where the writers that depend on this spelling now live. The separator a recipe reference’s path is built and reported with.

Type Aliases§

Result
Convenience alias for core results.