about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2021-09-19 01:30:12 +0600
committerNRK <nrk@disroot.org>2021-09-19 01:30:12 +0600
commitd728452b0ffdb56de3ae642b848477a48f290740 (patch)
treed2286ed0fadfb9d5d4662d496860e789924a9030
parent0d783e17a461da481a4803e3cf970a15f1500bf5 (diff)
downloadranger-d728452b0ffdb56de3ae642b848477a48f290740.tar.gz
add more detailed implementation note
-rwxr-xr-xexamples/rifle_sxiv.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/rifle_sxiv.sh b/examples/rifle_sxiv.sh
index 35c65da9..f65524a8 100755
--- a/examples/rifle_sxiv.sh
+++ b/examples/rifle_sxiv.sh
@@ -14,6 +14,20 @@
 # shell syntax and calls being made to external utilities, such as grep or find.
 # This makes it portable across many unix like systems, although it may not be
 # the cleanest or fastest approach.
+#
+# First, using case statement to get absolute path is quicker than calling
+# 'realpath' because it would fork a whole process, which is slow.
+#
+# Second, we need to append a file list to sxiv, which can only be done
+# properly in three ways: arrays (which are not POSIX) or \0 sperated strings.
+# Unfortunately, assigning \0 to a variable is not POSIX either (will not work
+# in dash and others), so we cannot store the result of listfiles to a
+# variable.
+#
+# The third approach is to store the result to a tmpfile and using `-i` to feed
+# the list to sxiv. This is the fastest approach since we won't have to call
+# listfiles twice.
+
 
 tmp="/tmp/sxiv_rifle_$$"