1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//! Rich, layered configuration for Rust applications.
//!
//! Clapfig manages configuration from multiple sources — config files,
//! environment variables, and programmatic overrides — with a builder API that
//! takes a few lines to set up. Built on [confique](https://docs.rs/confique)
//! for struct-driven defaults and template generation.
//!
//! # Core library — no CLI framework required
//!
//! The core of clapfig is a **pure Rust API** with no dependency on any CLI
//! framework. Config discovery, multi-file merging, environment variable
//! mapping, key lookup, persistence, and template generation all work through
//! [`ClapfigBuilder`] and [`ConfigAction`] without importing clap or any other
//! parser. You can use clapfig in GUI apps, servers, or with any CLI parser of
//! your choice.
//!
//! # Optional clap adapter (`clap` feature, on by default)
//!
//! For CLI apps using [clap](https://docs.rs/clap), clapfig ships an optional
//! adapter behind the **`clap`** Cargo feature (enabled by default). The [`cli`]
//! module provides [`ConfigArgs`](cli::ConfigArgs) and
//! [`ConfigSubcommand`](cli::ConfigSubcommand) — ready-made clap derive types
//! that give your app `config gen|list|get|set|unset` subcommands with zero
//! boilerplate. They convert to the framework-agnostic [`ConfigAction`] via
//! [`ConfigArgs::into_action()`](cli::ConfigArgs::into_action).
//!
//! To use clapfig **without** clap, disable default features:
//!
//! ```toml
//! clapfig = { version = "...", default-features = false }
//! ```
//!
//! # Three axes of configuration
//!
//! Config file handling is controlled by three orthogonal settings on the builder:
//!
//! - **Discovery** ([`search_paths()`](ClapfigBuilder::search_paths)): where to
//! look for config files. Supports explicit directories, platform paths, and
//! walking up the directory tree via [`SearchPath::Ancestors`](types::SearchPath::Ancestors).
//!
//! - **Resolution** ([`search_mode()`](ClapfigBuilder::search_mode)): what to do
//! with found files. [`Merge`](types::SearchMode::Merge) deep-merges all found
//! configs (layered overrides); [`FirstMatch`](types::SearchMode::FirstMatch)
//! uses only the highest-priority file found ("find my config").
//!
//! - **Persistence** ([`persist_scope()`](ClapfigBuilder::persist_scope)): named
//! targets for `config set` writes. Scope paths are auto-added to search paths.
//!
//! See the [`types`] module for the full conceptual documentation and use-case
//! examples.
//!
//! # Layer precedence (lowest to highest)
//!
//! 1. Compiled defaults (`#[config(default = ...)]`)
//! 2. Config files (discovery + resolution mode)
//! 3. Environment variables (`PREFIX__KEY`)
//! 4. Programmatic overrides (`.cli_override()`)
//!
//! Every layer is sparse — only the keys you specify are merged.
//!
//! # Quick start
//!
//! ```ignore
//! let config: AppConfig = Clapfig::builder()
//! .app_name("myapp")
//! .load()?;
//! ```
pub
pub use ;
pub use ;
pub use ClapfigError;
pub use ConfigResult;
pub use ;