aboutsummaryrefslogtreecommitdiff
path: root/swenu-path
diff options
context:
space:
mode:
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