dotfiles/.bin/OLD/eg

34 lines
815 B
Plaintext
Raw Normal View History

#!/bin/sh
. $HOME/.bin/_config
# build list...
build_list() {
L=$( ssh $USER@$DOMAIN \
"find \"$LOCAL_PATH\" \
! -path '*/hn/*' \
! -path '*/git/*' \
! -path '*/p/*' \
-type f \
\( -name '*.gph' \
-o -name '*.dcgi' \
-o -name '*.txt' \
-o -name '*.sh' \
\) \
| cut -b "$(( ${#LOCAL_PATH} + 2))- \
| sort -hr )
}
build_list
# edit loop
while true;
do
S=$( printf '%s' "$L" | fzf --no-sort )
[ "$?" -eq "130" ] && exit # fzf return 130 on ctrl+c
[ -z "$S" ] && continue
A="$( printf '%s\n%s' "EDIT" "DELETE" | fzf --no-sort )"
case $A in
EDIT) vim "scp://$USER@$DOMAIN/$LOCAL_PATH/$S"; ;;
DELETE) ssh $USER@$DOMAIN "rm $LOCAL_PATH/$S"; build_list; ;;
esac
done