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
// This file is part of helpers4.
// Copyright (C) 2025 baxyz
// SPDX-License-Identifier: LGPL-3.0-or-later
use parse_line;
/// Removes every assignment of `key` from dotenv `content` and returns the new content.
///
/// Comments, blank lines and other variables are left untouched. Removing a key that is not
/// assigned returns the content unchanged.
///
/// # Arguments
///
/// - `content` - The dotenv text to edit.
/// - `key` - The variable name to remove every assignment of.
///
/// # Examples
///
/// ```
/// use helpers4::env::remove;
///
/// assert_eq!(remove("A=1\nB=2\nA=3\n", "A"), "B=2\n");
/// ```