Info: Add checks to see if prin() was used directly
This commit is contained in:
parent
139c55f257
commit
6647c77096
1 changed files with 10 additions and 5 deletions
15
neofetch
15
neofetch
|
@ -1270,7 +1270,6 @@ get_song() {
|
||||||
else
|
else
|
||||||
prin "$subtitle" "$song"
|
prin "$subtitle" "$song"
|
||||||
fi
|
fi
|
||||||
unset song
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1680,8 +1679,6 @@ get_battery() {
|
||||||
|
|
||||||
prin "${subtitle}${bat: -1}" "$battery"
|
prin "${subtitle}${bat: -1}" "$battery"
|
||||||
done
|
done
|
||||||
|
|
||||||
unset battery
|
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -2429,12 +2426,17 @@ scrot_program() {
|
||||||
# TEXT FORMATTING
|
# TEXT FORMATTING
|
||||||
|
|
||||||
info() {
|
info() {
|
||||||
|
# Make sure that $prin is unset.
|
||||||
|
unset -v prin
|
||||||
|
|
||||||
# Call the function.
|
# Call the function.
|
||||||
"get_${2:-$1}" 2>/dev/null
|
"get_${2:-$1}" 2>/dev/null
|
||||||
|
|
||||||
|
# If the get_func function called 'prin' directly, stop here.
|
||||||
|
(( "$prin" == 1 )) && return
|
||||||
|
|
||||||
# Update the variable
|
# Update the variable
|
||||||
output="${2:-$1}"
|
output="$(trim "${!2:-${!1}}")"
|
||||||
output="$(trim "${!output}")"
|
|
||||||
|
|
||||||
if [[ "$2" && "${output// }" ]]; then
|
if [[ "$2" && "${output// }" ]]; then
|
||||||
length="$((${#1} + ${#output} + 2))"
|
length="$((${#1} + ${#output} + 2))"
|
||||||
|
@ -2464,6 +2466,9 @@ prin() {
|
||||||
|
|
||||||
# Calculate info height
|
# Calculate info height
|
||||||
info_height="$((info_height+=1))"
|
info_height="$((info_height+=1))"
|
||||||
|
|
||||||
|
# Log that prin was used.
|
||||||
|
prin=1
|
||||||
}
|
}
|
||||||
|
|
||||||
get_underline() {
|
get_underline() {
|
||||||
|
|
Loading…
Reference in a new issue