Skip to main content

vs_shell/
env.rs

1//! Environment delta rendering utilities for shell integrations.
2
3use std::path::PathBuf;
4
5/// Environment changes emitted by `vs`.
6#[derive(Debug, Clone, Default, PartialEq, Eq)]
7pub struct EnvDelta {
8    /// Environment variables to export.
9    pub vars: Vec<(String, String)>,
10    /// Additional PATH entries to prepend.
11    pub path_entries: Vec<PathBuf>,
12}
13
14impl EnvDelta {
15    /// Adds a variable export to the delta.
16    pub fn with_var(mut self, key: impl Into<String>, value: impl Into<String>) -> Self {
17        self.vars.push((key.into(), value.into()));
18        self
19    }
20
21    /// Adds a PATH entry to the delta.
22    pub fn with_path(mut self, value: PathBuf) -> Self {
23        self.path_entries.push(value);
24        self
25    }
26}