dot

packages and services management
Log | Files | Refs | README

commit 828af4b95a42794838ca13876bb30599cd80bee7
parent 31639f7faa952014d246ac37f12c60335ba846be
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sat, 29 Apr 2017 21:50:02 +0200

Feed.  Layer 08

Diffstat:
Mbin/io | 26++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/bin/io b/bin/io @@ -9,6 +9,16 @@ mkdir -p "$CACHE/find" touch "$CACHE/files" +# --- caching find ------------------------------------------------------------- + +find "$HOME" -maxdepth 1 -mindepth 1 -type d | sort | sed 's|.*/||' | +while IFS='' read -r dir +do + [ "$CACHE/find/$dir" -ot "$HOME/$dir" ] && + find "$HOME/$dir" -type f ! -path '*/.git/*' | sort > "$CACHE/find/$dir" +done + + # --- prompt ------------------------------------------------------------------- file="$({ @@ -19,18 +29,10 @@ file="$({ tac "$CACHE/files" printf '# All files\n' - find "$HOME" -maxdepth 1 -type f | sort - find "$HOME" -maxdepth 1 -mindepth 1 -type d | sort | - sed 's|.*/||' | while IFS='' read -r dir - do - if [ "$CACHE/find/$dir" -ot "$HOME/$dir" ] - then - find "$HOME/$dir" -type f ! -path '*/.git/*' | sort | - tee "$CACHE/find/$dir" - else - cat "$CACHE/find/$dir" - fi - done + find "$HOME" -maxdepth 1 -type f | sort + find "$HOME" -maxdepth 1 -mindepth 1 -type d | sed 's|.*/||' | + xargs -I % cat "$CACHE/find/%" + } | iomenu -s -p io)" name="$(printf %s "$file" | sed 's|/|!|g')"