q.sh/q-browse

19 lines
374 B
Text
Raw Normal View History

#!/bin/sh
if [[ -z "$@" ]]; then
echo "^f .*$"
elif [[ "$1" == "--hint" ]]; then
shift
elif [[ "$1" == "--complete" ]]; then
shift
echo "0 $@"
elif [[ "$1" == "--preview" ]]; then
shift
2024-11-03 23:36:22 +00:00
URL="$(echo "$@" | cut -d ' ' -f3-)"
echo "Will open '$URL' in firefox"
elif [[ "$1" == "--run" ]]; then
shift
2024-11-03 23:36:22 +00:00
URL="$(echo "$@" | cut -d ' ' -f3-)"
setsid -f xdg-open "$URL"
fi