attach from terminal with fzf

This commit is contained in:
Felix Van der Jeugt 2017-06-23 13:24:45 +02:00
parent f37e5e5ea6
commit 5c4318a022
No known key found for this signature in database
GPG Key ID: 58B209295023754D

View File

@ -1,8 +1,16 @@
#!/bin/bash
if [ -t 1 ]; then
pick() { fzf --height 10; }
run() { /usr/bin/abduco -A "$@" "$@"; clear; }
else
pick() { dmenu; }
run() { exec st -e /usr/bin/abduco -A "$@" "$@"; }
fi
result="$(case "$1" in
list) find ~/.abduco -not -executable -type s -exec basename \{\} \; | cut -d@ -f1 | dmenu ;;
run|watch) dmenu_path | dmenu ;;
list) find ~/.abduco -not -executable -type s -exec basename \{\} \; | cut -d@ -f1 | pick ;;
run|watch) dmenu_path | pick ;;
*) echo "other" ;;
esac)"
@ -13,8 +21,7 @@ if test "$result" = "other"; then
fi
case "$1" in
list) exec st -e /usr/bin/abduco -A "$result" ;;
watch) result="watch $result" ;&
run) exec st -e /usr/bin/abduco -A "$result" $result ;;
watch) result="watch $result" ;&
list|run) run $result ;;
esac