mirror of
https://github.com/octoleo/hosts.git
synced 2024-11-21 20:35:10 +00:00
Improve variable handling in _print_entries()
.
This commit is contained in:
parent
4238e8bd81
commit
f585447612
@ -5,6 +5,14 @@
|
|||||||
# https://github.com/koalaman/shellcheck/wiki/Ignore
|
# https://github.com/koalaman/shellcheck/wiki/Ignore
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
# Disable SC2183
|
||||||
|
#
|
||||||
|
# Running into this: https://github.com/koalaman/shellcheck/issues/1310
|
||||||
|
# TODO: Check if resolved.
|
||||||
|
#
|
||||||
|
#https://github.com/koalaman/shellcheck/wiki/SC2183
|
||||||
|
disable=SC2183
|
||||||
|
|
||||||
# Disable SC2206 and SC2207
|
# Disable SC2206 and SC2207
|
||||||
#
|
#
|
||||||
# `IFS` and `noglob` are set.
|
# `IFS` and `noglob` are set.
|
||||||
|
8
hosts
8
hosts
@ -344,7 +344,7 @@ _print_entries() {
|
|||||||
fi
|
fi
|
||||||
done <<< "${_input}"
|
done <<< "${_input}"
|
||||||
|
|
||||||
_max_divided="$((_max_length / 8))"
|
local _max_quotient="$((_max_length / 8))"
|
||||||
|
|
||||||
while IFS=$'\t ' read -r -a _parts
|
while IFS=$'\t ' read -r -a _parts
|
||||||
do
|
do
|
||||||
@ -354,9 +354,9 @@ _print_entries() {
|
|||||||
printf "disabled:\\n"
|
printf "disabled:\\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_current_divided=$((${#_parts[0]} / 8))
|
local _current_quotient=$((${#_parts[0]} / 8))
|
||||||
_tab_count=$((_max_divided - _current_divided + 1))
|
local _tab_count=$((_max_quotient - _current_quotient + 1))
|
||||||
# shellcheck disable=SC2183
|
local _tabs=
|
||||||
_tabs="$(printf "%*s" ${_tab_count} | tr " " '\t')"
|
_tabs="$(printf "%*s" ${_tab_count} | tr " " '\t')"
|
||||||
|
|
||||||
if [[ -n "${_parts[2]:-}" ]]
|
if [[ -n "${_parts[2]:-}" ]]
|
||||||
|
Loading…
Reference in New Issue
Block a user