From d39eee7a5e6f66289f91c0519f92203dd1b7469e Mon Sep 17 00:00:00 2001 From: Riley Beckett Date: Mon, 20 Oct 2025 17:12:32 -0400 Subject: generate list of executables and cache faster --- swenu-path | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'swenu-path') 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 -- cgit v1.2.3