#!/bin/sh # needs a better name # - - - - - - - - - - - - - - - - ARGS - - - - - - - - - - - - - - - - - show_help() { echo "Usage:" echo "1. Copy the desired Url to your clipboard" echo "2. ./edit_bookmarks_dmenu.sh BOOKMARKS" echo "Options:" echo " --help Display this help message" exit 1 } if [ "$#" -eq 0 ]; then echo "Nothing happened, I need a file of bookmarks to edit." show_help fi while [ "$#" -gt 0 ]; do case "$1" in --help) show_help ;; -*) echo "Error: Unknown option: $1" >&2 show_help ;; esac shift done dmenu_style() { local font='junicode-18' local normal_bg='#000000' local normal_fg='#FFFFFF' local selected_bg='#AAAAAA' local selected_fg='#000000' echo "-fn $font -nb $normal_bg -nf $normal_fg -sb $selected_bg -sf $selected_fg" } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- # TODO : process multiple files of BOOKMARKS at once BOOKMARKS=$1 URL=$(xclip -o -selection clipboard) # The curl for Name: is a blocking process and will pause the programm # in case internet shuts :^) # TODO : # add description, tags and color in one field with symbols such as : # § this is a description. § comma, separated, tags § color # If the given string ressembles to a url, continue. # https://stackoverflow.com/questions/21115121/how-to-test-if-string-matches-a-regex-in-posix-shell-not-bash # URL_REGEX="^(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|]" if printf "$URL" | grep -q http; then # TODO : incrementing id replacing