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 1
1
/* * @file */
2
2
#pragma once
3
3
4
+ #include < cstdio>
4
5
#include < iostream>
5
6
#include < string>
6
7
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
+ }
9
15
10
16
namespace CppSpec {
11
17
class Description ;
12
18
class ItBase ;
13
19
20
+ inline bool is_terminal () {
21
+ return _isatty (_fileno (stdout)) != 0 ;
22
+ }
14
23
namespace Formatters {
15
24
16
25
class BaseFormatter {
@@ -21,7 +30,7 @@ class BaseFormatter {
21
30
bool color_output;
22
31
23
32
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() )
25
34
: out_stream(out_stream), color_output(color) {}
26
35
BaseFormatter (const BaseFormatter &) = default ;
27
36
BaseFormatter (const BaseFormatter ©, std::ostream &out_stream)
Original file line number Diff line number Diff line change 6
6
#include < string>
7
7
8
8
#include " verbose.hpp"
9
+ #include " term_colors.hpp"
9
10
10
11
namespace CppSpec ::Formatters {
11
12
Original file line number Diff line number Diff line change 6
6
7
7
#include " class_description.hpp"
8
8
#include " formatters_base.hpp"
9
+ #include " term_colors.hpp"
9
10
10
11
namespace CppSpec ::Formatters {
11
12
Original file line number Diff line number Diff line change 8
8
#include " class_description.hpp"
9
9
#include " formatters_base.hpp"
10
10
#include " it_base.hpp"
11
+ #include " term_colors.hpp"
11
12
12
13
namespace CppSpec ::Formatters {
13
14
You can’t perform that action at this time.
0 commit comments