dot

packages and services management
Log | Files | Refs | README

commit 12750ecdeb0a5fed46c927c3bec0d92d8b06a128
parent b5282cd0e6295ef87e5d70a1780ecc664156963f
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Tue, 18 Jul 2017 23:50:55 +0200

removed tools superseeded by io

Diffstat:
Mbin/io | 3++-
Mbin/io-abduco | 34++++++++++++----------------------
Dbin/io-grep | 19-------------------
Dbin/io-run | 31-------------------------------
Mbin/io-search | 2+-
5 files changed, 15 insertions(+), 74 deletions(-)

diff --git a/bin/io b/bin/io @@ -94,4 +94,5 @@ path="${selection#* }" printf '\033[H\033[2J' -command -v "${command%% *}" && [ "$path" ] && exec io-abduco $command "$path" +command -v "${command%% *}" && [ "$path" ] && +exec io-abduco "$path" $command "$path" diff --git a/bin/io-abduco b/bin/io-abduco @@ -6,35 +6,25 @@ touch "$HOME/.abduco/names" # --- option ------------------------------------------------------------------- -if [ "$1" = -n ] -then - mode=-n - shift -else - mode=-A -fi +[ "$1" = -n ] && A=-n && shift || A=-A -if [ $# = 0 ] +if [ $# = 1 ] then - attach=0 -else - [ $# = 1 ] && command=$EDITOR || command= - attach=1 -fi + name="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")" + set -- "$EDITOR" "$1" -while [ $# -gt 1 ] -do - command="$command $1" +elif [ $# -gt 1 ] +then + name="$1" shift -done - +fi # --- update session names ----------------------------------------------------- -hash=`printf %s "$1" | cksum | cut -d ' ' -f 1` +hash=$(printf %s "$name" | cksum | cut -d ' ' -f 1) { - [ "$attach" = 1 ] && printf '%s %s\n' "$hash" "$1" + [ "$#" -gt 0 ] && printf '%s %s\n' "$hash" "$name" { abduco | awk -v FS='\t' 'NR > 1 { printf("-e\n%s\n", $3); }' @@ -44,11 +34,11 @@ hash=`printf %s "$1" | cksum | cut -d ' ' -f 1` } | sort -k 1,1 -u -o "$HOME/.abduco/names" -if [ "$attach" = 1 ] +if [ "$#" -gt 0 ] then [ "$SSH_TTY" ] && e='^\' || e='^Z' [ "$ABDUCO" != "$1" ] && - ABDUCO=$1 exec abduco -e "$e" $mode "$hash" $command "$1" + ABDUCO=$1 exec abduco -e "$e" $A "$hash" "$@" else sed 's/[^ ]* //' "$HOME/.abduco/names" fi diff --git a/bin/io-grep b/bin/io-grep @@ -1,19 +0,0 @@ -# run grep -r for a prompted directory and regex - -# enter a regex -printf '\033[30;47m regex \033[m ' -IFS='' read -r grep - -find $HOME -type d ! -path '*/.git/*' | iomenu -p path | -xargs -I % find % -type f ! -path '*/.git/*' | while IFS='' read -r file -do - printf '# %s\n' "$file" - grep -n "$regex" "$file" -done | awk 'match($0, /:/) { - num = substr($0, 1, RSTART - 1); - sub(/^[^:]*:/, ""); - printf("%7s\t", num); -} { print }' | iomenu -s -h | { - IFS=' ' read -r path number content - ${EDITOR:-vi} +"$number" "${path#\# }" -} diff --git a/bin/io-run b/bin/io-run @@ -1,31 +0,0 @@ -# prompt for a programs to run - - -CACHE=${XDG_CACHE_HOME:-$HOME/.cache} - - -# --- commands cache ----------------------------------------------------------- - -IFS=: - -stest -dqr -n "$CACHE/io/run" $PATH && -stest -flx $PATH | sort -u > "$CACHE/io/run" - -unset IFS - -# --- run ---------------------------------------------------------------------- - -command=`{ - printf '# ' - abduco | sed 's/.*\t//' | sed 's|!|/|g' - - printf '# Commands\n' - cat "$CACHE/io/run" - } | iomenu -s -p run -` - -name=`printf %s "$command" | sed 's|/|!|g'` - -[ "$SSH_TTY" ] && e='^\' || e='^Z' - -ABDUCO=$name exec abduco -e "$e" -A "$name" $command diff --git a/bin/io-search b/bin/io-search @@ -17,7 +17,7 @@ EOF [ "$path" ] || exit path="${path#\# }" - io-abduco -n $EDITOR +"`printf %s "$number" | tr -d ' '`" "$path" + io-abduco -n "$path" $EDITOR +"`printf %s "$number" | tr -d ' '`" "$path" done