[package]
name          = "esp-config"
version       = "0.6.1"
edition       = "2024"
rust-version  = "1.86.0"
description   = "Configure projects using esp-hal and related packages"
documentation = "https://docs.espressif.com/projects/rust/esp-config/latest/"
repository    = "https://github.com/esp-rs/esp-hal"
license       = "MIT OR Apache-2.0"

[package.metadata.espressif]
doc-config = { features = ["build"] }
check-configs = [
    { features = [] },
    { features = ["build"] },
]
clippy-configs = [
    { features = ["tui"] },
]

[lib]
bench = false
test  = true

[[bin]]
name = "esp-config"
required-features = ["tui"]

[dependencies]
document-features = "0.2"

# used by the `build` and `tui` feature
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
serde_yaml = { version =  "0.9", optional = true }
somni-expr = { version = "0.2.0", optional = true }
esp-metadata-generated = { version = "0.3.0", path = "../esp-metadata-generated", features = ["build-script"], optional = true }

# used by the `tui` feature
clap            = { version = "4.5", features = ["derive"], optional = true }
env_logger      = { version = "0.11", optional = true }
log             = { version = "0.4", optional = true }
ratatui         = { version = "0.29", features = ["crossterm", "unstable"], optional = true }
toml_edit       = { version = "0.23", optional = true }
tui-textarea    = { version = "0.7", optional = true }
cargo_metadata  = { version = "0.23", optional = true }

[dev-dependencies]
temp-env = "0.3.6"
pretty_assertions = "1.4.1"

[features]
## Enable the generation and parsing of a config
build = ["dep:serde", "dep:serde_yaml", "dep:somni-expr", "dep:esp-metadata-generated"]

## The TUI
tui = [
    "dep:clap",
    "dep:env_logger",
    "dep:log",
    "dep:ratatui",
    "dep:toml_edit",
    "dep:tui-textarea",
    "dep:cargo_metadata",
    "dep:esp-metadata-generated",
    "build",
]
