aboutsummaryrefslogtreecommitdiff
path: root/.config/shell/zsh-fast-syntax-highlighting/fast-read-ini-file
diff options
context:
space:
mode:
authorkj-sh6042025-07-16 22:10:52 -0400
committerkj-sh6042025-07-16 22:10:52 -0400
commit1e204d36c1fab9884f65618ccca019d8cd5f9386 (patch)
tree962ebadaa02a15d2f8441b290daf330bfbd48417 /.config/shell/zsh-fast-syntax-highlighting/fast-read-ini-file
parent7c9e54b5366ada655baf8c2b61914182840d6bb6 (diff)
refactor: update `zsh-fast-syntax-highlighting` plugin
Diffstat (limited to '.config/shell/zsh-fast-syntax-highlighting/fast-read-ini-file')
-rw-r--r--.config/shell/zsh-fast-syntax-highlighting/fast-read-ini-file30
1 files changed, 0 insertions, 30 deletions
diff --git a/.config/shell/zsh-fast-syntax-highlighting/fast-read-ini-file b/.config/shell/zsh-fast-syntax-highlighting/fast-read-ini-file
deleted file mode 100644
index 2e57d10..0000000
--- a/.config/shell/zsh-fast-syntax-highlighting/fast-read-ini-file
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright (c) 2018 Sebastian Gniazdowski
-#
-# $1 - path to the ini file to parse
-# $2 - name of output hash (INI by default)
-# $3 - prefix for keys in the hash (can be empty)
-#
-# Writes to given hash under keys built in following way: ${3}<section>_field.
-# Values are values from ini file.
-
-local __ini_file="$1" __out_hash="${2:-INI}" __key_prefix="$3"
-local IFS='' __line __cur_section="void" __access_string
-local -a match mbegin mend
-
-[[ ! -r "$__ini_file" ]] && { builtin print -r "fast-syntax-highlighting: an ini file is unreadable ($__ini_file)"; return 1; }
-
-while read -r -t 1 __line; do
- if [[ "$__line" = [[:blank:]]#\;* ]]; then
- continue
- elif [[ "$__line" = (#b)[[:blank:]]#\[([^\]]##)\][[:blank:]]# ]]; then
- __cur_section="${match[1]}"
- elif [[ "$__line" = (#b)[[:blank:]]#([^[:blank:]=]##)[[:blank:]]#[=][[:blank:]]#(*) ]]; then
- match[2]="${match[2]%"${match[2]##*[! $'\t']}"}" # remove trailing whitespace
- __access_string="${__out_hash}[${__key_prefix}<$__cur_section>_${match[1]}]"
- : "${(P)__access_string::=${match[2]}}"
- fi
-done < "$__ini_file"
-
-return 0
-
-# vim:ft=zsh:sw=4:sts=4:et