Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
terminal.hh
Go to the documentation of this file.
1#pragma once
3
4#include <limits>
5#include <string>
6
8
9namespace nix {
10
14bool isTTY(Descriptor fd);
15
16enum class StandardOutputStream {
17 Stdout = 1,
18 Stderr = 2,
19};
20
34bool isOutputARealTerminal(StandardOutputStream fileno);
35
51bool shouldANSI(StandardOutputStream fileno = StandardOutputStream::Stderr);
52
60std::string filterANSIEscapes(
61 std::string_view s, bool filterAll = false, unsigned int width = std::numeric_limits<unsigned int>::max());
62
67std::string stripANSIEscapes(std::string_view s);
68
74void updateWindowSize();
75
82std::pair<unsigned short, unsigned short> getWindowSize();
83
90std::string getPtsName(int fd);
91
92} // namespace nix
File descriptor operations for almost arbitrary file descriptors.
int Descriptor
Definition file-descriptor.hh:36
void updateWindowSize()
Definition terminal.cc:206
std::string getPtsName(int fd)
Definition terminal.cc:233
std::string stripANSIEscapes(std::string_view s)
Definition terminal.cc:185
bool isTTY(Descriptor fd)
Definition terminal.cc:68
bool shouldANSI(StandardOutputStream fileno=StandardOutputStream::Stderr)
Definition terminal.cc:84
std::string filterANSIEscapes(std::string_view s, bool filterAll=false, unsigned int width=std::numeric_limits< unsigned int >::max())
Definition terminal.cc:143
bool isOutputARealTerminal(StandardOutputStream fileno)
Definition terminal.cc:78
std::pair< unsigned short, unsigned short > getWindowSize()
Definition terminal.cc:227