#!/usr/bin/env sh
# newsboat bookmarking plugin for bmm
#
# add the following to your newsboat config, and adjust the path as needed.
# bookmark-cmd ~/.config/newsboat/scripts/bookmark-bmm.sh
# bookmark-interactive yes

url="$1"
# title="$2" #you can comment this out and rely on bmm to get the title if you prefer.
#desc="$3" # not used by bmm, bmm will get this information for you.
#feed_title="$4" don't think this is of any use to us either?

bmm="$(command -v bmm)"

echo "Enter some tags comma seperated: "
read -r tags

if [ -z "${tags}" ]; then
  # you can set default tags here
  tags="todo"
fi

if [ -n "${bmm}" ]; then
  # bmm save-all -t "${tags}" --title "${title}" "${url}" >/dev/null
  bmm save --tags "${tags:-"todo"}" "${url}" >/dev/null
fi
