From ecdf1aa05271c2b5c33c9fcbb77e39d47f8a669d Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 26 Apr 2018 18:58:13 -0400 Subject: bin/hwmon: Make indentation level configurable --- (limited to 'bin/hwmon') diff --git a/bin/hwmon b/bin/hwmon index 8dac456..7f2f0f4 100755 --- a/bin/hwmon +++ b/bin/hwmon @@ -130,12 +130,13 @@ format_power() print_sensor() { - local label="${1}" - local len=${2} - local chip="${3}" - local chips="${4}" - local element="${5}" - shift 5 + local indent=${1} + local label="${2}" + local len=${3} + local chip="${4}" + local chips="${5}" + local element="${6}" + shift 6 local hwmon= local value= local i= @@ -164,7 +165,12 @@ print_sensor() ;; esac - printf ' %s:' "${label}" + i=0 + while [ ${i} -lt ${indent} ]; do + printf ' ' + i=$((${i} + 1)) + done + printf '%s:' "${label}" i=${#label} while [ ${i} -lt ${len} ]; do printf ' ' @@ -184,12 +190,14 @@ usage() '