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
39
use clap::ValueEnum;
/// Supported path-like environment variables.
#[derive(Clone, Copy, Debug, Eq, PartialEq, ValueEnum)]
pub enum PathVariable {
/// Executable search path.
Path,
/// Manual page search path.
Manpath,
}
impl PathVariable {
/// Stable CLI and JSON string.
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::Path => "path",
Self::Manpath => "manpath",
}
}
/// Environment variable name for POSIX shell output and process lookup.
#[must_use]
pub const fn env_name(self) -> &'static str {
match self {
Self::Path => "PATH",
Self::Manpath => "MANPATH",
}
}
/// PowerShell environment variable name.
#[must_use]
pub const fn powershell_env_name(self) -> &'static str {
match self {
Self::Path => "Path",
Self::Manpath => "MANPATH",
}
}
}