|
FlatImage
A configurable Linux containerization system
|
Environment variable management utilities. More...
Enumerations | |
| enum class | Replace { Y , N } |
Functions | |
| template<ns_concept::StringRepresentable T, ns_concept::StringRepresentable U> | |
| void | set (T &&name, U &&value, Replace replace) |
| Sets an environment variable. | |
| template<ns_string::static_string S = "E"> | |
| Value< std::string > | get_expected (std::string_view name) |
| Get the value of an environment variable. | |
| bool | exists (std::string_view name, std::string_view value) |
| Checks if variable exists and equals value. | |
| Value< std::string > | expand (ns_concept::StringRepresentable auto &&var) |
| Performs variable expansion analogous to a POSIX shell. | |
| template<typename T = std::string> | |
| Value< T > | xdg_data_home () noexcept |
| Returns or computes the value of XDG_DATA_HOME. | |
| Value< fs::path > | search_path (std::string const &query) |
| Search the directories in the PATH variable for the given input file name. | |
Environment variable management utilities.
Provides type-safe environment variable operations including get/set with default values, PATH searching for executables, variable expansion, and existence checking.
|
inline |
|
inline |
Performs variable expansion analogous to a POSIX shell.
| auto | Type that is string representable (constrained by concept) |
| var | Source string to expand |
Definition at line 96 of file env.hpp.
|
inline |
Get the value of an environment variable.
| T | The output type of the function |
| name | The name of the variable |
Definition at line 65 of file env.hpp.
|
inlinenodiscard |
Search the directories in the PATH variable for the given input file name.
| query | The file name to search for in PATH directories |
Definition at line 150 of file env.hpp.
| void ns_env::set | ( | T && | name, |
| U && | value, | ||
| Replace | replace ) |
Sets an environment variable.
| T | StringRepresentable |
| U | StringRepresentable |
| name | Variable name |
| value | Variable value |
| replace | Should it be replace if it exists? |
Definition at line 52 of file env.hpp.
|
inlinenoexcept |
Returns or computes the value of XDG_DATA_HOME.
| T | The return type for the path (defaults to std::string, can be fs::path or other string-convertible types) |
Definition at line 135 of file env.hpp.