q.sh/q-bookmarks
2024-09-09 02:03:52 +01:00

27 lines
588 B
Bash
Executable file

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