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
//! Nushell configuration infrastructure.
//!
//! This crate owns **all** XDG-aware path resolution for Nushell configuration
//! files and directories. It is the single source of truth for *where* config
//! lives. It does **not** evaluate or parse config files — that is the job of
//! `nu-cli` / the `nu` binary.
//!
//! # Architecture
//!
//! ```text
//! CLI flags + process env + platform dirs
//! │
//! ▼
//! resolve_paths() ← one-shot at startup
//! │
//! ▼
//! NushellConfigDirs ← stored on EngineState.config_dirs
//! │
//! ┌────────┼────────┬──────────────┐
//! ▼ ▼ ▼ ▼
//! $nu.* loaders history plugins
//! ```
//!
//! After startup, **do not** re-read `XDG_*` env vars or call free path helpers.
//! Always read from [`NushellConfigDirs`].
//!
//! # Resolution priority
//!
//! For every path:
//!
//! 1. CLI override ([`CliOverrides`] — e.g. `--config-home`, `--config`)
//! 2. XDG environment variable (e.g. `$XDG_CONFIG_HOME`)
//! 3. Platform default via the [`EnvAccess`] seam
//!
//! # Testing
//!
//! Use [`TestEnv`] to inject env vars and platform directories without touching
//! the host process. Prefer unit tests in this crate over spawning `nu` for pure
//! path-resolution logic.
// Convenience re-exports so callers don't need to dig into sub-modules.
pub use ConfigFileKind;
pub use ;
pub use ;
pub use CliOverrides;
pub use ;
pub use resolve_paths;
extern crate nu_test_support;
use main;