2023-05-14 17:24:43 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-05-14 19:24:27 +00:00
|
|
|
ENV_xdg_open=xdg-open
|
|
|
|
ENV_cut=cut
|
|
|
|
|
2023-05-14 17:24:43 +00:00
|
|
|
if [[ -z "$@" ]]; then
|
|
|
|
echo "^f .*$"
|
|
|
|
elif [[ "$1" == "--hint" ]]; then
|
|
|
|
shift
|
|
|
|
elif [[ "$1" == "--complete" ]]; then
|
|
|
|
shift
|
|
|
|
echo "0 $@"
|
|
|
|
elif [[ "$1" == "--preview" ]]; then
|
|
|
|
shift
|
2023-05-14 19:24:27 +00:00
|
|
|
URL="$(echo "$@" | $ENV_cut -d ' ' -f3-)"
|
2023-05-14 17:24:43 +00:00
|
|
|
echo "Will open '$URL' in firefox"
|
|
|
|
elif [[ "$1" == "--run" ]]; then
|
|
|
|
shift
|
2023-05-14 19:24:27 +00:00
|
|
|
URL="$(echo "$@" | $ENV_cut -d ' ' -f3-)"
|
|
|
|
(nohup $ENV_xdg_open "$URL" 2>/dev/null &)
|
2023-05-14 17:24:43 +00:00
|
|
|
sleep 0.01
|
|
|
|
fi
|