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