2023-05-14 17:24:43 +00:00
|
|
|
#!/bin/sh
|
2021-10-11 08:44:40 +00:00
|
|
|
|
|
|
|
if [[ -z "$@" ]]; then
|
2024-11-03 01:59:02 +00:00
|
|
|
echo "^c .*$"
|
2021-10-11 08:44:40 +00:00
|
|
|
elif [[ "$1" == "--hint" ]]; then
|
2024-11-03 01:59:02 +00:00
|
|
|
shift
|
|
|
|
if [[ -f ~/.clipboard.txt ]]; then
|
2024-11-03 23:36:22 +00:00
|
|
|
cat ~/.clipboard.txt | tac
|
2024-11-03 01:59:02 +00:00
|
|
|
fi
|
2021-10-11 08:44:40 +00:00
|
|
|
elif [[ "$1" == "--complete" ]]; then
|
2024-11-03 01:59:02 +00:00
|
|
|
shift
|
|
|
|
if [[ -f ~/.clipboard.txt ]]; then
|
2024-11-03 23:36:22 +00:00
|
|
|
cat ~/.clipboard.txt | tac
|
2024-11-03 01:59:02 +00:00
|
|
|
fi
|
2021-10-11 08:44:40 +00:00
|
|
|
elif [[ "$1" == "--preview" ]]; then
|
2024-11-03 01:59:02 +00:00
|
|
|
shift
|
2024-11-03 23:36:22 +00:00
|
|
|
echo "$1" | base64 -d
|
2021-10-11 08:44:40 +00:00
|
|
|
elif [[ "$1" == "--run" ]]; then
|
2024-11-03 01:59:02 +00:00
|
|
|
shift
|
2024-11-03 23:36:22 +00:00
|
|
|
TEXT="$(echo "$1" | base64 -d)"
|
2024-11-03 01:59:02 +00:00
|
|
|
echo "$TEXT"
|
2024-11-03 23:36:22 +00:00
|
|
|
echo -n "$TEXT" | (setsid -f wl-copy)
|
2021-10-11 08:44:40 +00:00
|
|
|
else
|
2024-11-03 01:59:02 +00:00
|
|
|
echo "Unexpected arguments: $@"
|
2021-10-11 08:44:40 +00:00
|
|
|
fi
|