diff options
author | Bryan Drewery <bryan@shatow.net> | 2021-11-18 17:47:35 +0300 |
---|---|---|
committer | Bryan Drewery <bryan@shatow.net> | 2021-11-18 17:47:35 +0300 |
commit | b2e6a55e487f2ac2de33d60a6f5711b53b3f4b2a (patch) | |
tree | c45cab56c515e3ef0166ddebeeb830e16781190d /src | |
parent | 1e6ad2b54aeb411e7836569aa24adb398e4de1a2 (diff) |
display: Don't size header into cols when hidden
Diffstat (limited to 'src')
-rw-r--r-- | src/share/poudriere/include/display.sh | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/share/poudriere/include/display.sh b/src/share/poudriere/include/display.sh index 8e761c93..e7666f58 100644 --- a/src/share/poudriere/include/display.sh +++ b/src/share/poudriere/include/display.sh @@ -29,7 +29,7 @@ display_setup() { _DISPLAY_DATA= _DISPLAY_FORMAT="$1" _DISPLAY_COLUMNS="$2" - _DISPLAY_COLUMN_SORT="$3" + _DISPLAY_COLUMN_SORT="${3-}" } display_add() { @@ -67,7 +67,12 @@ display_output() { format="${_DISPLAY_FORMAT}" # Determine optimal format + n=0 while mapfile_read_loop_redir line; do + n=$((n + 1)) + if [ "${n}" -eq 1 -a "${quiet}" -eq 1 ]; then + continue + fi eval "set -- ${line}" cnt=0 for arg in "$@"; do @@ -86,7 +91,8 @@ display_output() { EOF # Set format lengths if format is dynamic width - if [ "${format##*%%*}" != "${format}" ]; then + case "${format}" in + *%%*) set -- ${format} lengths= n=0 @@ -100,7 +106,8 @@ display_output() { n=$((n + 1)) done format=$(printf "${format}" ${lengths}) - fi + ;; + esac # Show header separately so it is not sorted if [ "${quiet}" -eq 0 ]; then |