Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/freebsd/poudriere.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/share
diff options
context:
space:
mode:
authorBryan Drewery <bryan@shatow.net>2021-11-24 08:20:37 +0300
committerBryan Drewery <bryan@shatow.net>2021-11-24 06:31:11 +0300
commitab3713fa4a987ded6f2d7207831716bbd904c524 (patch)
treec8ec87ccc13b739224bfff84ad163b14f1e3e3ad /src/share
parent77a6100129c82484813a8d971f05820fc095d879 (diff)
display_output: Strip ansi colors from headers and when sizing fields
Diffstat (limited to 'src/share')
-rw-r--r--src/share/poudriere/include/display.sh17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/share/poudriere/include/display.sh b/src/share/poudriere/include/display.sh
index 43045a58..d4009e9c 100644
--- a/src/share/poudriere/include/display.sh
+++ b/src/share/poudriere/include/display.sh
@@ -47,6 +47,7 @@ display_add() {
display_output() {
local cnt lengths length format arg flag quiet line n
+ local header header_format
local OPTIND=1
quiet=0
@@ -70,13 +71,17 @@ display_output() {
n=0
while mapfile_read_loop_redir line; do
n=$((n + 1))
- if [ "${n}" -eq 1 -a "${quiet}" -eq 1 ]; then
- continue
+ if [ "${n}" -eq 1 ]; then
+ if [ "${quiet}" -eq 1 ]; then
+ continue
+ fi
+ header="${line}"
fi
eval "set -- ${line}"
cnt=0
for arg in "$@"; do
hash_get lengths ${cnt} max_length || max_length=0
+ stripansi "${arg}" arg
if [ ${#arg} -gt ${max_length} ]; then
# Keep the hash var local to this function
_hash_var_name "lengths" "${cnt}"
@@ -116,10 +121,10 @@ display_output() {
# Show header separately so it is not sorted
if [ "${quiet}" -eq 0 ]; then
- echo "${_DISPLAY_DATA}"| head -n 1 | while read line; do
- eval "set -- ${line}"
- printf "${format}\n" "$@"
- done
+ stripansi "${header}" header
+ stripansi "${format}" header_format
+ eval "set -- ${header}"
+ printf "${header_format}\n" "$@"
fi
# Sort as configured in display_setup()