pub fn append_to_wslenv<'a>(
existing: Option<&str>,
keys: impl IntoIterator<Item = &'a str>,
) -> StringExpand description
Add keys to a WSLENV value, preserving whatever was already there.
WSLENV is a :-separated list of variable names, each optionally suffixed with flags.
Names are added bare: usage has no idea whether a given value is a path, and /p would
silently rewrite anything that merely looks like one. Unflagged names copy the value
verbatim, so a script sees the same bytes it would on Unix.
Existing entries are never rewritten or dropped — a name the caller configured is theirs.
But an existing entry for a name usage is about to set does not stop usage adding its own
bare one unless it carries the value verbatim: a usage_foo/p
inherited from somewhere would otherwise mean the script sees nothing at all. Listing the
name twice is how it is fixed rather than a problem to avoid — WSL takes the entry that
transfers, so FOO/p:FOO arrives as plain FOO.
Takes the current value as an argument instead of reading the environment so it stays a pure function, testable on every platform rather than only where it does anything.