q.sh/q-bookmarks

25 lines
517 B
Text
Raw Normal View History

#!/bin/sh
2021-10-10 20:26:06 +00:00
if [[ -z "$@" ]]; then
echo "^b .*$"
2021-10-10 20:26:06 +00:00
elif [[ "$1" == "--hint" ]]; then
shift
if [[ -f ~/.bookmarks.txt ]]; then
cat ~/.bookmarks.txt | awk '{print $1 " b " $2}'
fi
2021-10-10 20:26:06 +00:00
elif [[ "$1" == "--complete" ]]; then
shift
if [[ -f ~/.bookmarks.txt ]]; then
cat ~/.bookmarks.txt | awk '{print $1 " b " $2}'
fi
2021-10-10 20:26:06 +00:00
elif [[ "$1" == "--preview" ]]; then
shift
echo "$1"
2021-10-10 20:26:06 +00:00
elif [[ "$1" == "--run" ]]; then
shift
xdg-open "$1"
2021-10-10 20:26:06 +00:00
else
echo "Unexpected arguments: $@"
2021-10-10 20:26:06 +00:00
fi