File tree Expand file tree Collapse file tree 4 files changed +15
-3
lines changed
Expand file tree Collapse file tree 4 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 11/* * @file */
22#pragma once
33
4+ #include < cstdio>
45#include < iostream>
56#include < string>
67
7- #include " term_colors.hpp"
8-
8+ extern " C" {
9+ #ifdef _WIN32
10+ #include < io.h>
11+ #else
12+ #include < unistd.h>
13+ #endif
14+ }
915
1016namespace CppSpec {
1117class Description ;
1218class ItBase ;
1319
20+ inline bool is_terminal () {
21+ return _isatty (_fileno (stdout)) != 0 ;
22+ }
1423namespace Formatters {
1524
1625class BaseFormatter {
@@ -21,7 +30,7 @@ class BaseFormatter {
2130 bool color_output;
2231
2332 public:
24- explicit BaseFormatter (std::ostream &out_stream = std::cout, bool color = true )
33+ explicit BaseFormatter (std::ostream &out_stream = std::cout, bool color = is_terminal() )
2534 : out_stream(out_stream), color_output(color) {}
2635 BaseFormatter (const BaseFormatter &) = default ;
2736 BaseFormatter (const BaseFormatter ©, std::ostream &out_stream)
Original file line number Diff line number Diff line change 66#include < string>
77
88#include " verbose.hpp"
9+ #include " term_colors.hpp"
910
1011namespace CppSpec ::Formatters {
1112
Original file line number Diff line number Diff line change 66
77#include " class_description.hpp"
88#include " formatters_base.hpp"
9+ #include " term_colors.hpp"
910
1011namespace CppSpec ::Formatters {
1112
Original file line number Diff line number Diff line change 88#include " class_description.hpp"
99#include " formatters_base.hpp"
1010#include " it_base.hpp"
11+ #include " term_colors.hpp"
1112
1213namespace CppSpec ::Formatters {
1314
You can’t perform that action at this time.
0 commit comments