dot

packages and services management
Log | Files | Refs | README

commit bf62c42d1f225f86cfa2958019e521575dc973b6
parent e7b8677a8298f805bfcc5412dc332465ef6cffa9
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sat, 29 Apr 2017 13:17:38 +0200

Fixed io-ii-less and io-run

Diffstat:
M.profile | 8++++----
Mbin/io | 2+-
Mbin/io-ii-less | 2+-
Mbin/io-run | 24+++++++++++++++++++++++-
4 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/.profile b/.profile @@ -16,7 +16,7 @@ export OPT SRC ETC ROOT # paths ENV="$HOME/.profile" -PATH="$ETC/bin:$ROOT/sbin:$ROOT/bin:$PATH:$PLAN9/bin" +PATH="$ETC/bin:$ROOT/bin:$PATH:$PLAN9/bin" MANPATH="$ETC/man:$ROOT/share/man:$ROOT/man:$MANPATH" MAIL="$HOME/var/mail/INBOX" export ENV PATH MANPATH MAIL @@ -55,9 +55,9 @@ export EDITOR VISUAL PAGER MANPAGER DVTM_PAGER BROWSER PS1=' $(date +"[%H:%M]" ) $PWD/$(git-status)${SSH_TTY:+ $(hostname)}${ABDUCO:+ $ABDUCO} ${?#0} -$(jobs | wc -l | sed s/0/❯/)❯ ' -PS2=' ❯ ' -PS3=' ❯ ' +$(jobs | wc -l | sed s/0//)» ' +PS2=' » ' +PS3=' » ' export PS1 PS2 PS3 diff --git a/bin/io b/bin/io @@ -23,7 +23,7 @@ file="$({ find "$HOME" -maxdepth 1 -mindepth 1 -type d | sort | sed 's|.*/||' | while IFS='' read -r dir do - if [ "$HOME/$dir" -nt "$CACHE/find/$dir" ] + if [ "$CACHE/find/$dir" -ot "$HOME/$dir" ] then find "$HOME/$dir" -type f ! -path '*/.git/*' | sort | tee "$CACHE/find/$dir" diff --git a/bin/io-ii-less b/bin/io-ii-less @@ -8,5 +8,5 @@ do find "${IRC:-$HOME/var/irc}" -mindepth 1 -type d | iomenu -p ii )" - [ -f "$name/out" ] && tail -f -n 1000 "$name/out" | ii-filter | less + [ -f "$name/out" ] && tail -f -n 512 "$name/out" | ii-filter | less done diff --git a/bin/io-run b/bin/io-run @@ -1,11 +1,33 @@ # prompt for a programs to run + +CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/io" + + +# --- cache -------------------------------------------------------------------- + +IFS=':' + +[ ! -f "$CACHE/run" ] && UPDATE='1' || for path in $PATH +do + [ "$CACHE/run" -ot "$path" ] && UPDATE='1' && break +done + +[ "$UPDATE" ] && +find -L . $PATH -maxdepth 1 -type f -exec test -x {} \; -print | +sed 's/.*\///' | sort -u -o "$CACHE/run" + +unset IFS + + +# --- run ---------------------------------------------------------------------- + command="$({ printf '# ' abduco | sed 's/.*\t//' | sed 's|!|/|g' printf '# Commands\n' - IFS=:; stest -flx $PATH | sort -u + cat "$CACHE/run" } | iomenu -s -p run )" name="$(printf %s "$command" | sed 's|/|!|')"