aboutsummaryrefslogtreecommitdiff
path: root/swenu-path
diff options
context:
space:
mode:
authorRiley Beckett <rbeckettvt@gmail.com>2025-10-20 17:12:32 -0400
committerRiley Beckett <rbeckettvt@gmail.com>2025-10-20 17:13:25 -0400
commitd39eee7a5e6f66289f91c0519f92203dd1b7469e (patch)
tree448ea0e666eb175a9457a975bad4fd415285e45e /swenu-path
parent024cee7e848ff8550a52db0667f26a53c54d5478 (diff)
generate list of executables and cache faster
Diffstat (limited to 'swenu-path')
-rwxr-xr-xswenu-path14
1 files changed, 10 insertions, 4 deletions
diff --git a/swenu-path b/swenu-path
index a720d5c..fb58b5b 100755
--- a/swenu-path
+++ b/swenu-path
@@ -1,6 +1,12 @@
#!/bin/sh
-IFS=:
-for dir in $PATH; do
- [ -e ${dir} ] && find ${dir} -executable -printf '%f\n'
-done | sort -u
+cachedir="${XDG_CACHE_HOME:-"$HOME/.cache"}"
+cache="$cachedir/swenu-run"
+
+[ ! -e "$cachedir" ] && mkdir -p "$cachedir"
+
+if swenu-exes "$cache"; then
+ swenu-exes | sort -u | tee $cache
+else
+ cat $cache
+fi