FlatImage
A configurable Linux containerization system
Loading...
Searching...
No Matches
env.hpp File Reference

A library for manipulating environment variables. More...

#include <concepts>
#include <cstdlib>
#include <wordexp.h>
#include <ranges>
#include "../std/expected.hpp"
#include "../std/string.hpp"
#include "../common.hpp"
#include "../macro.hpp"
Include dependency graph for env.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  ns_env
 Environment variable management utilities.
 

Enumerations

enum class  Replace { Y , N }
 

Functions

template<ns_concept::StringRepresentable T, ns_concept::StringRepresentable U>
void ns_env::set (T &&name, U &&value, Replace replace)
 Sets an environment variable.
 
template<ns_string::static_string S = "E">
Value< std::string > ns_env::get_expected (std::string_view name)
 Get the value of an environment variable.
 
bool ns_env::exists (std::string_view name, std::string_view value)
 Checks if variable exists and equals value.
 
Value< std::string > ns_env::expand (ns_concept::StringRepresentable auto &&var)
 Performs variable expansion analogous to a POSIX shell.
 
template<typename T = std::string>
Value< T > ns_env::xdg_data_home () noexcept
 Returns or computes the value of XDG_DATA_HOME.
 
Value< fs::path > ns_env::search_path (std::string const &query)
 Search the directories in the PATH variable for the given input file name.
 

Detailed Description

A library for manipulating environment variables.

Author
Ruan Formigoni

Definition in file env.hpp.