README + Junicode + better args

This commit is contained in:
clemtre 2024-01-15 17:16:35 +01:00
parent a142a39ef0
commit c7b311f742
4 changed files with 47 additions and 4 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ Junicode*
starred starred
.* .*
.gitignore .gitignore
jquery-3.7.1.slim.min.js

View File

@ -14,6 +14,7 @@ command line but I suggest to bind it to a keystroke combination.
Clone this repository, make signet.sh executable and run signet.sh Clone this repository, make signet.sh executable and run signet.sh
``` ```
git clone https://git.vvvvvvaria.org/clemtre/signet.sh.git git clone https://git.vvvvvvaria.org/clemtre/signet.sh.git
cd signet.sh
chmod +x signet.sh chmod +x signet.sh
./signet.sh ./signet.sh
``` ```
@ -150,11 +151,13 @@ Works on my machine : Ubuntu 20 LTS, it should work on any POSIX
compliant machine, macOS, linux* or bsd*. I'm curious to know how it compliant machine, macOS, linux* or bsd*. I'm curious to know how it
goes on windows :^) goes on windows :^)
## this repo
clone the repo clone the repo
``` ```
git clone https://git.vvvvvvaria.org/clemtre/signet.sh.git git clone https://git.vvvvvvaria.org/clemtre/signet.sh.git
cd signet.sh cd signet.sh
chmod +x signet.sh
``` ```
# Dependency : # Dependency :
@ -236,6 +239,15 @@ starred.sh → curl from the github user api and format it in the same
way as signet.sh without using jq way as signet.sh without using jq
https://api.github.com/users/[user]/starred https://api.github.com/users/[user]/starred
# Naming
The name is subject to change.
I thought about naming it *boussole* which means compass, as in the tool
you use to orient yourself in your navigation. This name puts the
emphasis on the index.html page. On the other hand Victor suggested
*signet*, it stands for the actual pieces of paper used as bookmarks
inserted between the pages of a bound object →
https://www.cnrtl.fr/definition/signet
# Other bookmark managers: # Other bookmark managers:
- nb https://xwmx.github.io/nb/ (AGPL-3.0) - nb https://xwmx.github.io/nb/ (AGPL-3.0)
- ?? - ??

View File

@ -1,5 +1,33 @@
#!/bin/sh #!/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() { dmenu_style() {
local font='junicode-18' local font='junicode-18'
local normal_bg='#000000' local normal_bg='#000000'
@ -8,8 +36,10 @@ dmenu_style() {
local selected_fg='#000000' local selected_fg='#000000'
echo "-fn $font -nb $normal_bg -nf $normal_fg -sb $selected_bg -sf $selected_fg" echo "-fn $font -nb $normal_bg -nf $normal_fg -sb $selected_bg -sf $selected_fg"
} }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --
BOOKMARKS="BOOKMARKS" # TODO : process multiple files of BOOKMARKS at once
BOOKMARKS=$1
URL=$(xclip -o -selection clipboard) URL=$(xclip -o -selection clipboard)
@ -24,9 +54,11 @@ URL=$(xclip -o -selection clipboard)
# https://stackoverflow.com/questions/21115121/how-to-test-if-string-matches-a-regex-in-posix-shell-not-bash # 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+&@#/%=~_|]" # URL_REGEX="^(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|]"
if printf "$URL" | grep -q http; then if printf "$URL" | grep -q http; then
# incrementing id soon to be implemented replacing <ol> counter # TODO : incrementing id replacing <ol> list counter
#PREV_URL_COUNT=$(grep "URL: " $BOOKMARKS | wc -l) #PREV_URL_COUNT=$(grep "URL: " $BOOKMARKS | wc -l)
#ID: $((PREV_URL_COUNT + 1)) #ID: $((PREV_URL_COUNT + 1))
# TODO : add the bookmark in reverse, last in first first on the stack
# maybe using tac instead of cat ?
cat <<- EOF >> $BOOKMARKS cat <<- EOF >> $BOOKMARKS
URL: $(printf $URL) URL: $(printf $URL)

File diff suppressed because one or more lines are too long