Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sympl
Sympl Testing Suite
Commits
e34eef71
Commit
e34eef71
authored
Apr 14, 2021
by
Paul Cammish
Browse files
Strip escape codes from logs
parent
1eed44fe
Changes
1
Show whitespace changes
Inline
Side-by-side
sympl-tests
View file @
e34eef71
...
...
@@ -41,7 +41,7 @@ _echo() {
}
_log
()
{
echo
"
$@
"
>>
$LOG
echo
"
$@
"
|
sed
's|\\033[[0-9;]*m||g'
>>
$LOG
}
_pass
()
{
...
...
@@ -88,16 +88,16 @@ _test_error() {
_centre
()
{
spacer
=
"
$1
"
line
=
"
$2
"
stripped_line
=
"
$(
echo
$line
|
sed
's|\\033[[0-9;]*m||g'
)
"
if
[
$VERBOSE
]
;
then
col
=
"
$(
tput cols
)
"
||
col
=
80
col
=
$((
col
-
3
))
stripped_line
=
"
$(
echo
$line
|
sed
's|\\033[[0-9;]*m||g'
)
"
len
=
$((
(
col
/
2
)
-
(
(
${#
stripped_line
}
+
1
)
/
2
)
))
echo
-e
"
\0
33[2m
$(
for
each
in
$(
seq
1
$len
)
;
do
printf
"
$spacer
"
;
done
)
\0
33[0m
$line
\0
33[2m
$(
for
each
in
$(
seq
1
$len
)
;
do
printf
"
$spacer
"
;
done
)
\0
33[0m"
fi
col
=
78
len
=
$((
(
col
/
2
)
-
(
(
${#
line
}
+
1
)
/
2
)
))
_log
"
$(
for
each
in
$(
seq
1
$len
)
;
do
printf
"
$spacer
"
;
done
)
$line
$(
for
each
in
$(
seq
1
$len
)
;
do
printf
"
$spacer
"
;
done
)
"
|
cut
-c
1-
$((
col
))
len
=
$((
(
col
/
2
)
-
(
(
${#
stripped_
line
}
+
1
)
/
2
)
))
_log
"
$(
for
each
in
$(
seq
1
$len
)
;
do
printf
"
$spacer
"
;
done
)
$
stripped_
line
$(
for
each
in
$(
seq
1
$len
)
;
do
printf
"
$spacer
"
;
done
)
"
|
cut
-c
1-
$((
col
))
}
#############################################################################
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment