File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ StyledStrings.resetfaces!
25
25
StyledStrings.termcolor
26
26
StyledStrings.termcolor24bit
27
27
StyledStrings.termcolor8bit
28
+ StyledStrings.load_customisations!
28
29
```
29
30
30
31
## Styled Markup parsing
Original file line number Diff line number Diff line change @@ -16,12 +16,29 @@ include("legacy.jl")
16
16
17
17
using . StyledMarkup
18
18
19
- function __init__ ()
19
+ const HAVE_LOADED_CUSTOMISATIONS = Base. Threads. Atomic {Bool} (false )
20
+
21
+ """
22
+ load_customisations!(; force::Bool=false)
23
+
24
+ Load customisations from the user's `faces.toml` file, if it exists as well as
25
+ the current environment.
26
+
27
+ This function should be called before producing any output in situations where
28
+ the user's customisations should be considered.
29
+
30
+ Unless `force` is set, customisations are only applied when this function is
31
+ called for the first time, and subsequent calls are a no-op.
32
+ """
33
+ function load_customisations! (; force:: Bool = false )
34
+ ! force && HAVE_LOADED_CUSTOMISATIONS[] && return
20
35
if ! isempty (DEPOT_PATH )
21
36
userfaces = joinpath (first (DEPOT_PATH ), " config" , " faces.toml" )
22
37
isfile (userfaces) && loaduserfaces! (userfaces)
23
38
end
24
39
Legacy. load_env_colors! ()
40
+ HAVE_LOADED_CUSTOMISATIONS[] = true
41
+ nothing
25
42
end
26
43
27
44
if Base. generating_output ()
You can’t perform that action at this time.
0 commit comments