q.sh/q-bookmarks

24 lines
517 B
Bash
Executable file

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