dotfiles/.bin/bm
2023-02-22 08:31:38 +01:00

33 lines
752 B
Bash
Executable File

#!/bin/sh
# this is work in progress
# bookmark file format descrition
#
# date | uri | tags | title
# 2021-01-06 | http://example.com | tech, whatever | Title
add() {
_date="$(date +"%Y-%m-%d")"
_url="$1"
shift
_desc0="$@"
_desc1="$(curl -sL $_url | hxclean | hxselect -ic 'title' 2>/dev/null)"
printf '%s | %s | %s | %s\n' "$_date" "$_url" "$_desc0" "$_desc1"
}
case $1 in
add) shift; add $@;
;;
rm)
;;
list)
;;
*) printf '%s\n%s\n%s\n' \
"bm add <url> [descr] - Add new entry to bookmark file" \
" del <url> - Delete entry from bookmark file" \
" list [filter] - Show bookmark file";
;;
esac