Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
env.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
20
21#include "sham/term/color.hpp"
23#include <string_view>
24#include <optional>
25
26namespace sham::term {
27
33 struct TermEnvVars {
34 std::optional<std::string_view> TERM;
35 std::optional<std::string_view> COLORTERM;
36 std::optional<std::string_view> NO_COLOR;
37 std::optional<std::string_view> CLICOLOR_FORCE;
38 std::optional<std::string_view> COLUMN;
39 std::optional<std::string_view> LANG;
40 std::optional<std::string_view> lc_all;
41 std::optional<std::string_view> lc_ctype;
42 std::optional<std::string_view> NO_UTF8;
43 std::optional<std::string_view> FORCE_UTF8;
44 };
45
54
57 void parse_terminal_support(TermEnvVars vars, const term_parse_callback_t &error_callback);
58
59} // namespace sham::term
Terminal color escape sequences and enable/disable control.
ColorLevel
The possible levels of terminal color support.
Definition color.hpp:27
Shared callback type definition for parsing error handling.
std::function< std::invalid_argument(const char *what, std::source_location where)> term_parse_callback_t
Callback signature for parsing error reporting (returns what, receives source location).
void parse_terminal_support(TermEnvVars vars, const term_parse_callback_t &error_callback)
Parses terminal environment variables to determine color support and set terminal size.
Definition env.cpp:132
ColorLevel detect_color_level(TermEnvVars vars)
Detect the terminal emulator's color support level from TERM/COLORTERM.
Definition env.cpp:103
Holds optional terminal environment variables (TERM, COLORTERM, NO_COLOR, CLICOLOR_FORCE,...
Definition env.hpp:33