Skip to main content

vs_shell/
env.rs

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