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