23 lines
576 B
Bash
Executable file
23 lines
576 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 '{printf("%s b", $1); for (i=2; i<=NF; i++) printf(" %s", $i); print("");}'
|
|
fi
|
|
elif [[ "$1" == "--complete" ]]; then
|
|
shift
|
|
if [[ -f ~/.bookmarks.txt ]]; then
|
|
cat ~/.bookmarks.txt | awk '{printf("%s b", $1); for (i=2; i<=NF; i++) printf(" %s", $i); print("");}'
|
|
fi
|
|
elif [[ "$1" == "--preview" ]]; then
|
|
shift
|
|
echo "$1"
|
|
elif [[ "$1" == "--run" ]]; then
|
|
shift
|
|
xdg-open "$2"
|
|
else
|
|
echo "Unexpected arguments: $@"
|
|
fi
|