configuration/local/bin/abduco

28 lines
588 B
Plaintext
Raw Normal View History

2016-09-15 10:13:22 +02:00
#!/bin/bash
2017-06-23 13:24:45 +02:00
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
2016-09-15 10:13:22 +02:00
result="$(case "$1" in
2017-06-23 13:24:45 +02:00
list) find ~/.abduco -not -executable -type s -exec basename \{\} \; | cut -d@ -f1 | pick ;;
run|watch) dmenu_path | pick ;;
2016-09-15 10:13:22 +02:00
*) echo "other" ;;
esac)"
2016-11-03 10:26:10 +01:00
[ -z "$result" ] && exit 1
2016-09-15 10:13:22 +02:00
if test "$result" = "other"; then
exec /usr/bin/abduco "$@"
fi
case "$1" in
2017-06-23 13:24:45 +02:00
watch) result="watch $result" ;&
list|run) run $result ;;
2016-09-15 10:13:22 +02:00
esac