q.sh/q-browse

18 lines
373 B
Bash
Executable file

#!/bin/sh
if [[ -z "$@" ]]; then
echo "^f .*$"
elif [[ "$1" == "--hint" ]]; then
shift
elif [[ "$1" == "--complete" ]]; then
shift
echo "0 $@"
elif [[ "$1" == "--preview" ]]; then
shift
URL="$(echo "$@" | cut -d ' ' -f3-)"
echo "Will open '$URL' in firefox"
elif [[ "$1" == "--run" ]]; then
shift
URL="$(echo "$1" | cut -d ' ' -f2-)"
setsid -f firefox "$URL"
fi