q.sh/q-clipboard

25 lines
507 B
Bash
Executable file

#!/bin/sh
if [[ -z "$@" ]]; then
echo "^c .*$"
elif [[ "$1" == "--hint" ]]; then
shift
if [[ -f ~/.clipboard.txt ]]; then
cat ~/.clipboard.txt | tac
fi
elif [[ "$1" == "--complete" ]]; then
shift
if [[ -f ~/.clipboard.txt ]]; then
cat ~/.clipboard.txt | tac
fi
elif [[ "$1" == "--preview" ]]; then
shift
echo "$1" | base64 -d
elif [[ "$1" == "--run" ]]; then
shift
TEXT="$(echo "$2" | base64 -d)"
echo "$TEXT"
echo -n "$TEXT" | (setsid -f wl-copy)
else
echo "Unexpected arguments: $@"
fi