21#if __has_include(<unistd.h>)
25#if __has_include(<sys/ioctl.h>)
26 #include <sys/ioctl.h>
32#if __has_include(<unistd.h>)
33 return isatty(fileno(stdout));
65#if __has_include(<sys/ioctl.h>) && __has_include(<unistd.h>)
67 ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
70 if (w.ws_col == 0 || w.ws_row == 0) {
73 return {w.ws_row, w.ws_col};
std::uint32_t u32
32 bit unsigned integer
namespace for cli utilities
void set_tty_columns(u32 columns)
Set the forced width of the terminal.
bool is_a_tty()
Test if current terminal is a tty.
std::pair< u32, u32 > get_tty_dim()
Get the number of columns and lines of the current terminal.
u32 get_tty_lines()
Get the number of lines of the current terminal.
u32 get_tty_columns()
Get the number of columns of the current terminal.
This file contains tty info getters.