Skip to content

Commit 3b04f10

Browse files
committed
Change how to enable / disable ANSI output
Now using the newly added RSP_ENABLE_ANSI option.
1 parent 9670949 commit 3b04f10

File tree

1 file changed

+11
-22
lines changed
  • docs/+current/modules/output

1 file changed

+11
-22
lines changed

docs/+current/modules/output/ansi.md

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,20 @@ allow you to format and style your console output.
1212

1313
[TOC]
1414

15-
## How to enable
15+
## How to enable / disable
1616

17-
To enable ANSI output, call the `enable_ansi()`. It is **recommended** that you only do so, if your project is the
18-
top-level cmake project.
17+
To enable ANSI output, set the `RSP_ENABLE_ANSI` option to `true`, when importing this project.
18+
By default, the option is set to `false`.
1919

2020
```cmake
21-
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
22-
include("rsp/output")
23-
24-
enable_ansi()
25-
endif()
26-
```
27-
28-
!!! warning "Warning"
29-
The `enable_ansi()` caches preset of ANSI escape sequences. This means that even if you remove
30-
the function call, ANSI will remain enabled, unless you explicitly [disable it](#how-to-disable) again.
31-
32-
## How to disable
33-
34-
```cmake
35-
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
36-
include("rsp/output")
37-
38-
disable_ansi()
39-
endif()
21+
CPMAddPackage(
22+
NAME rsp-cmake-scripts
23+
GITHUB_REPOSITORY "https://github.com/rsps/cmake-scripts.git"
24+
VERSION x.y.z
25+
OPTIONS
26+
"RSP_ENABLE_ANSI true"
27+
# ...remaining not shown ...
28+
)
4029
```
4130

4231
## Example

0 commit comments

Comments
 (0)