1#include "../include/printer.hpp"
8 return isatty(fileno(stdout));
14 for (
auto const &port : ports) {
15 if (isTerm) [[likely]] {
16 std::println(
"{}{}\tis{}accessible{}", port.second ?
GREEN :
RED, port.first,
17 port.second ?
" " :
" not ",
RESET);
19 std::println(
"{}\tis{}accessible", port.first, port.second ?
" " :
" not ");
static void print(std::vector< std::pair< port_t, bool > > const &ports)
Prints to stdout the formated information about the ports accessibility.
static bool isTerminal() noexcept
Checks if stdout is connected to a terminal.
std::string_view constexpr RED
ANSI escape code for red text color.
std::string_view constexpr GREEN
ANSI escape code for green text color.
std::string_view constexpr RESET
ANSI escape code for resetting terminal colors.