mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
terminal.cpp
Go to the documentation of this file.
2
3#include <mutable/util/fn.hpp>
4#include <cstdlib>
5
6
8{
9 constexpr const char *SUPPORTED_TERMS[] = {
10 "ansi",
11 "color",
12 "cygwin",
13 "linux",
14 "rxvt-unicode-256color",
15 "vt100",
16 "xterm",
17 "xterm-256",
18 "xterm-256color",
19 };
20 if (auto term = std::getenv("TERM")) {
21 for (auto supported : SUPPORTED_TERMS) {
22 if (m::streq(term, supported))
23 return true;
24 }
25 }
26 return false;
27}
bool M_EXPORT has_color()
Returns true if the terminal is known to support colors, false otherwise.
Definition: terminal.cpp:7
bool streq(const char *first, const char *second)
Definition: fn.hpp:29