aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsinanmohd <sinan@firemail.cc>2023-08-02 16:12:03 +0530
committersinanmohd <sinan@firemail.cc>2023-08-02 16:35:37 +0530
commit7258e85c6bcfa8ed34bd8b6250dff244775ac525 (patch)
tree47e89e6749deb001f0d0be49f1103ca5afb4c4d2
parente4223ebcabbba82b92f8652e78d0c43db7507355 (diff)
dbook: lazy evaluate value of keys
-rwxr-xr-xdbook12
1 files changed, 6 insertions, 6 deletions
diff --git a/dbook b/dbook
index 3ea4128..126626c 100755
--- a/dbook
+++ b/dbook
@@ -109,19 +109,19 @@ parse_data()
[ -z "$line" ] && continue
_key="${line%%|*}"
- _value="${line##*|}"
_key="$(trim "$_key")"
- _value="$(trim "$_value")"
case "$_key" in
#*) continue
esac
if [ "$1" = "getval" ]; then
- if [ "$2" = "$_key" ]; then
- echo "$_value"
- return 0
- fi
+ [ "$2" != "$_key" ] && continue
+
+ _value="${line##*|}"
+ _value="$(trim "$_value")"
+ echo "$_value"
+ return 0
else
echo "$(load_icon "$_value")" "$_key"
fi