mirror of
https://github.com/octoleo/hosts.git
synced 2024-11-21 12:25:14 +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
|
||||
###############################################################################
|
||||
|
||||
# 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
|
||||
#
|
||||
# `IFS` and `noglob` are set.
|
||||
|
8
hosts
8
hosts
@ -344,7 +344,7 @@ _print_entries() {
|
||||
fi
|
||||
done <<< "${_input}"
|
||||
|
||||
_max_divided="$((_max_length / 8))"
|
||||
local _max_quotient="$((_max_length / 8))"
|
||||
|
||||
while IFS=$'\t ' read -r -a _parts
|
||||
do
|
||||
@ -354,9 +354,9 @@ _print_entries() {
|
||||
printf "disabled:\\n"
|
||||
fi
|
||||
|
||||
_current_divided=$((${#_parts[0]} / 8))
|
||||
_tab_count=$((_max_divided - _current_divided + 1))
|
||||
# shellcheck disable=SC2183
|
||||
local _current_quotient=$((${#_parts[0]} / 8))
|
||||
local _tab_count=$((_max_quotient - _current_quotient + 1))
|
||||
local _tabs=
|
||||
_tabs="$(printf "%*s" ${_tab_count} | tr " " '\t')"
|
||||
|
||||
if [[ -n "${_parts[2]:-}" ]]
|
||||
|
Loading…
Reference in New Issue
Block a user