mise-util 2026.11.14

Environment, directory, and filesystem helpers shared by mise's crates
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! The User-Agent mise sends with HTTP requests, registered by mise at startup
//! (it names mise's version and the shell it was invoked from).

use std::sync::OnceLock;

static USER_AGENT: OnceLock<String> = OnceLock::new();

/// Register the User-Agent, e.g. `mise/2026.9.14 macos-arm64 (2026-09-25) zsh`.
pub fn set(user_agent: String) {
    let _ = USER_AGENT.set(user_agent);
}

/// The registered User-Agent.
pub fn get() -> &'static str {
    USER_AGENT
        .get()
        .expect("mise_util::user_agent::set must be called first")
}