mirror of
https://github.com/The-Repo-Club/DotFiles.git
synced 2024-11-25 00:38:20 -05:00
BM
This commit is contained in:
parent
700a61f4a9
commit
30d9bb6ef1
@ -19,6 +19,7 @@ function pacman
|
||||
command sudo pacman --color auto -Qttdq | command sudo pacman --color auto -Rns -
|
||||
end
|
||||
else if [ "$argv" = --upall ]
|
||||
command sudo pkgfile -u
|
||||
command sudo pacman -Fy
|
||||
command sudo pacman -Sy
|
||||
command pikaur -Su
|
||||
|
@ -12,7 +12,7 @@
|
||||
#Created:
|
||||
# Fri 09 December 2022, 07:19:23 AM [GMT]
|
||||
#Modified:
|
||||
# Fri 09 December 2022, 08:24:49 AM [GMT]
|
||||
# Fri 14 July 2023, 11:47:25 PM [GMT+1]
|
||||
#
|
||||
#Description:
|
||||
# <Todo>
|
||||
@ -46,10 +46,10 @@ config() {
|
||||
export _BM_CONFIG_FILE='none'
|
||||
fi
|
||||
# _BM_BOOKMARK_FILE : Where is stored the bookmark file
|
||||
export _BM_BOOKMARK_FILE="${_BM_BOOKMARK_FILE:=${__w}bm.bmf}"
|
||||
export _BM_BOOKMARK_FILE="${_BM_BOOKMARK_FILE:=${__w}bm.bm}"
|
||||
|
||||
# _BM_BOOKMARK_BACKUP_FILE : Where is stored the backup of bookmark file
|
||||
export _BM_BOOKMARK_BACKUP_FILE="${_BM_BOOKMARK_BACKUP_FILE:=${__w}.bm.bmf.bck}"
|
||||
export _BM_BOOKMARK_BACKUP_FILE="${_BM_BOOKMARK_BACKUP_FILE:=${__w}.bm.bm.bck}"
|
||||
|
||||
# _BM_HTML_FILE : Location of generated HTML file
|
||||
export _BM_HTML_FILE="${_BM_HTML_FILE:=${__w}bm.html}"
|
||||
@ -102,7 +102,7 @@ config() {
|
||||
export _BM_NO_ARGS_FORCE_HELP=${_BM_NO_ARGS_FORCE_HELP:=false}
|
||||
|
||||
# _BM_CREATE_BOOKMARK_FILE : If bm is called to list and no file exists. bm will create a default one.
|
||||
export _BM_CREATE_BOOKMARK_FILE=${_BM_CREATE_BOOKMARK_FILE:=false}
|
||||
export _BM_CREATE_BOOKMARK_FILE=${_BM_CREATE_BOOKMARK_FILE:=true}
|
||||
|
||||
# _BM_CMD_CAPTURE_CHECK : If you don't have tool installed to take screenshot, just put to false.
|
||||
# It will disable the _BM_GET_SCREENSHOT.
|
||||
@ -242,7 +242,7 @@ Usage: ${0} [modifier(s)] command [option(s)]
|
||||
|
||||
-C Print the color table (usefull for configuration)
|
||||
|
||||
-E Open the bm.bmf with your \$EDITOR
|
||||
-E Open the bm.bm with your \$EDITOR
|
||||
|
||||
-S Show statistics about bookmarks/tags (and also configuration)
|
||||
Options for -S
|
||||
@ -351,14 +351,8 @@ readLines() {
|
||||
#
|
||||
|
||||
list_bookmarks() {
|
||||
[[ ${__n:=0} -eq 1 ]] && {
|
||||
awk '$0 !~ /^[ ]*#/' "${_BM_BOOKMARK_FILE}" | sort -t'|' -k2 | readLines
|
||||
return
|
||||
}
|
||||
[[ ${__N:=0} -eq 1 ]] && {
|
||||
awk '$0 !~ /^[ ]*#/' "${_BM_BOOKMARK_FILE}" | sort -t'|' -k2 -r | readLines
|
||||
return
|
||||
}
|
||||
[[ ${__n:=0} -eq 1 ]] && { awk '$0 !~ /^[ ]*#/' "${_BM_BOOKMARK_FILE}" | sort -t'|' -k2 | readLines; return; }
|
||||
[[ ${__N:=0} -eq 1 ]] && { awk '$0 !~ /^[ ]*#/' "${_BM_BOOKMARK_FILE}" | sort -t'|' -k2 -r | readLines; return; }
|
||||
awk '$0 !~ /^[ ]*#/' "${_BM_BOOKMARK_FILE}" | readLines
|
||||
}
|
||||
|
||||
@ -369,26 +363,11 @@ search() {
|
||||
local _s=''
|
||||
[[ -z "${1:-}" ]] && list_bookmarks && return
|
||||
case "${1:0:1}" in
|
||||
:)
|
||||
_s=3
|
||||
_ss=0
|
||||
;; # Accelerator
|
||||
+)
|
||||
_s="NF"
|
||||
_ss=1
|
||||
;; # Tags
|
||||
=)
|
||||
_s=1
|
||||
_ss=1
|
||||
;; # MD5 part
|
||||
/)
|
||||
_s=4
|
||||
_ss=1
|
||||
;; # URL part
|
||||
*)
|
||||
_s=0
|
||||
_ss=0
|
||||
;; # full text search
|
||||
:) _s=3; _ss=0 ;; # Accelerator
|
||||
+) _s="NF"; _ss=1 ;; # Tags
|
||||
=) _s=1; _ss=1 ;; # MD5 part
|
||||
/) _s=4; _ss=1 ;; # URL part
|
||||
*) _s=0; _ss=0 ;; # full text search
|
||||
esac
|
||||
[[ "${_BM_SEARCH_IGNORECASE,,}" = 'true' || ${__i:=0} -eq 1 ]] && local _ign=1
|
||||
awk -F'|' -vIgn=${_ign:=0} '
|
||||
@ -400,14 +379,8 @@ $0 !~ /^[ ]*#/ && (Ign == 0 && $'"${_s}"' ~ s) || (Ign ==1 && tolower($'"${_s}"
|
||||
|
||||
}
|
||||
search_bookmarks() {
|
||||
[[ ${__n:=0} -eq 1 ]] && {
|
||||
search "${@}" | sort -t'|' -k2 | readLines
|
||||
return
|
||||
}
|
||||
[[ ${__N:=0} -eq 1 ]] && {
|
||||
search "${@}" | sort -t'|' -k2 -r | readLines
|
||||
return
|
||||
}
|
||||
[[ ${__n:=0} -eq 1 ]] && { search "${@}" | sort -t'|' -k2 | readLines; return; }
|
||||
[[ ${__N:=0} -eq 1 ]] && { search "${@}" | sort -t'|' -k2 -r | readLines; return; }
|
||||
search "${@}" | readLines
|
||||
}
|
||||
|
||||
@ -557,35 +530,22 @@ stats() {
|
||||
|
||||
echo "# of tags : $( sort -u <<< "${tags,,}" |wc -l)"
|
||||
echo "Top 14 tags used :"
|
||||
local nli=0
|
||||
local pa=0
|
||||
local nli=0;local pa=0
|
||||
(
|
||||
sort <<< "${tags,,}" | uniq -c | sort -nr | while read n t; do
|
||||
((nli++))
|
||||
[[ ${nli} -gt 7 ]] && nli=1 && echo ''
|
||||
((pa++))
|
||||
[[ ${pa} -gt 14 ]] && break
|
||||
(( nli++ ));[[ ${nli} -gt 7 ]] && nli=1 && echo ''
|
||||
(( pa++ ));[[ ${pa} -gt 14 ]] && break
|
||||
echo -n "${t// / }:${n} "
|
||||
done
|
||||
echo ''
|
||||
) | column -t -c 17
|
||||
echo "# of Pictures : $(ls -1 "${_BM_SCREENSHOT_DIRECTORY}"/*.png |wc -l) [# of files in ${_BM_SCREENSHOT_DIRECTORY}:$(ls -1 "${_BM_SCREENSHOT_DIRECTORY}"/* |wc -l)]"
|
||||
echo "All Pictures size : $(du -sh "${_BM_SCREENSHOT_DIRECTORY}" | awk '{print $1}')"
|
||||
local orphaned="$(
|
||||
cd "${_BM_SCREENSHOT_DIRECTORY}" && for i in *; do [[ -z "$(sed -e '/'"${i%%.*}"'/!d' "${_BM_BOOKMARK_FILE}")" ]] && ((orph++)); done
|
||||
echo "${orph:=0}"
|
||||
)"
|
||||
local nopics="$(
|
||||
while read i; do [[ ! -f "${_BM_SCREENSHOT_DIRECTORY}/${i%%|*}.png" ]] && ((nopics++)); done <<<${lines[@]}
|
||||
echo "${nopics:=0}"
|
||||
)"
|
||||
local orphaned="$( cd "${_BM_SCREENSHOT_DIRECTORY}" && for i in *; do [[ -z "$(sed -e '/'"${i%%.*}"'/!d' "${_BM_BOOKMARK_FILE}")" ]] && ((orph++)); done; echo "${orph:=0}" )"
|
||||
local nopics="$( while read i; do [[ ! -f "${_BM_SCREENSHOT_DIRECTORY}/${i%%|*}.png" ]] && ((nopics++)); done <<< ${lines[@]}; echo "${nopics:=0}" )"
|
||||
echo "Bookmark Without Pic : ${nopics}"
|
||||
echo "Orphaned pictures : ${orphaned}"
|
||||
[[ ${__p:=0} -eq 1 ]] && {
|
||||
echo -e "\n===== Orphaned ====="
|
||||
echo "List of orphaned pictures :"
|
||||
cd "${_BM_SCREENSHOT_DIRECTORY}" && for i in *; do [[ -z "$(sed -e '/'"${i%%.*}"'/!d' "${_BM_BOOKMARK_FILE}")" ]] && echo " - ${_BM_SCREENSHOT_DIRECTORY}/${i} [Trashed URL should be: $(awk -F'|' 'BEGIN{l="Unknown"} ($1 ~ /'"${i%%.*}"'/) {l=$4;} END {print l}' "${_BM_DELETE_FILE}")]"; done
|
||||
}
|
||||
[[ ${__p:=0} -eq 1 ]] && { echo -e "\n===== Orphaned ====="; echo "List of orphaned pictures :"; cd "${_BM_SCREENSHOT_DIRECTORY}" && for i in *; do [[ -z "$(sed -e '/'"${i%%.*}"'/!d' "${_BM_BOOKMARK_FILE}")" ]] && echo " - ${_BM_SCREENSHOT_DIRECTORY}/${i} [Trashed URL should be: $(awk -F'|' 'BEGIN{l="Unknown"} ($1 ~ /'"${i%%.*}"'/) {l=$4;} END {print l}' "${_BM_DELETE_FILE}")]"; done; };
|
||||
}
|
||||
|
||||
#
|
||||
@ -597,8 +557,7 @@ list_tags() {
|
||||
local nli=0
|
||||
(
|
||||
sort <<< "${tags,,}" | uniq -c | sort -nr | while read n t; do
|
||||
((nli++))
|
||||
[[ ${nli} -gt 7 ]] && nli=1 && echo ''
|
||||
(( nli++ ));[[ ${nli} -gt 7 ]] && nli=1 && echo ''
|
||||
echo -n "${t// / }:${n} "
|
||||
done
|
||||
echo ''
|
||||
@ -688,21 +647,11 @@ EOF
|
||||
screenshot_take() {
|
||||
if [ "${_BM_SCREENSHOT_GET,,}" = 'true' -o ${__p:=0} -eq 1 ]; then
|
||||
[[ ! -d "${_BM_SCREENSHOT_DIRECTORY}" ]] && { mkdir -p "${_BM_SCREENSHOT_DIRECTORY}" || die "Can't create thumbnail directory." ; }
|
||||
[[ ! -z "${_BM_CMD_PRE_CAPTURE}" ]] && {
|
||||
local _pre="${_BM_CMD_PRE_CAPTURE//\{FILE\}/${1}}"
|
||||
_pre="${_pre//\{URL\}/${2}}"
|
||||
${_pre}
|
||||
}
|
||||
local _cmd="${_BM_CMD_CAPTURE//\{FILE\}/${1}}"
|
||||
_cmd="${_cmd//\{URL\}/${2}}"
|
||||
local _args="${_BM_CMD_CAPTURE_ARGS//\{FILE\}/${1}}"
|
||||
_args="${_args//\{URL\}/${2}}"
|
||||
[[ ! -z "${_BM_CMD_PRE_CAPTURE}" ]] && { local _pre="${_BM_CMD_PRE_CAPTURE//\{FILE\}/${1}}"; _pre="${_pre//\{URL\}/${2}}"; ${_pre} ; }
|
||||
local _cmd="${_BM_CMD_CAPTURE//\{FILE\}/${1}}"; _cmd="${_cmd//\{URL\}/${2}}";
|
||||
local _args="${_BM_CMD_CAPTURE_ARGS//\{FILE\}/${1}}"; _args="${_args//\{URL\}/${2}}";
|
||||
eval ${_cmd} ${_args}
|
||||
[[ ! -z "${_BM_CMD_POST_CAPTURE}" ]] && {
|
||||
local _post="${_BM_CMD_POST_CAPTURE//\{FILE\}/${1}}"
|
||||
_post="${_post//\{URL\}/${2}}"
|
||||
${_post}
|
||||
}
|
||||
[[ ! -z "${_BM_CMD_POST_CAPTURE}" ]] && { local _post="${_BM_CMD_POST_CAPTURE//\{FILE\}/${1}}"; _post="${_post//\{URL\}/${2}}"; ${_post} ; }
|
||||
fi
|
||||
}
|
||||
|
||||
@ -760,6 +709,7 @@ die() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# checkBinaries check the script is able to run and give hints
|
||||
#
|
||||
@ -781,12 +731,12 @@ checkBinaries() {
|
||||
[[ ${rc:=0} -ne 0 ]] && die "At least one command is missing. Please install it before using bm."
|
||||
# Checking sed
|
||||
local rc=1
|
||||
[[ ! -f "/tmp/sedtest.$$" ]] &&
|
||||
echo -n 'toto' >"/tmp/sedtest.$$" &&
|
||||
sed -i.bak -e 's;^toto$;tata;' "/tmp/sedtest.$$" &&
|
||||
[[ -f "/tmp/sedtest.$$.bak" ]] &&
|
||||
grep -q "tata" "/tmp/sedtest.$$" &&
|
||||
rc=0 &&
|
||||
[[ ! -f "/tmp/sedtest.$$" ]] && \
|
||||
echo -n 'toto' > "/tmp/sedtest.$$" && \
|
||||
sed -i.bak -e 's;^toto$;tata;' "/tmp/sedtest.$$" && \
|
||||
[[ -f "/tmp/sedtest.$$.bak" ]] && \
|
||||
grep -q "tata" "/tmp/sedtest.$$" && \
|
||||
rc=0 && \
|
||||
rm -f "/tmp/sedtest.$$" "/tmp/sedtest.$$.bak"
|
||||
[[ ${rc} -ne 0 ]] && die "sed seems to not handle -i argument properly, please check"
|
||||
}
|
||||
@ -796,34 +746,20 @@ checkBinaries() {
|
||||
#
|
||||
|
||||
defineColors() {
|
||||
export BLACK="\e[30m"
|
||||
export BLACK_LIGHT="\e[90m"
|
||||
export GRAY_DARK="${BLACK_LIGHT}"
|
||||
export RED="\e[31m"
|
||||
export RED_LIGHT="\e[91m"
|
||||
export GREEN="\e[32m"
|
||||
export GREEN_LIGHT="\e[92m"
|
||||
export YELLOW="\e[33m"
|
||||
export YELLOW_LIGHT="\e[93m"
|
||||
export BLUE="\e[34m"
|
||||
export BLUE_LIGHT="\e[94m"
|
||||
export MAGENTA="\e[35m"
|
||||
export MAGENTA_LIGHT="\e[95m"
|
||||
export CYAN="\e[36m"
|
||||
export CYAN_LIGHT="\e[96m"
|
||||
export GRAY="\e[37m"
|
||||
export GRAY_LIGHT="\e[97m"
|
||||
export WHITE="${GRAY_LIGHT}"
|
||||
export BLACK="\e[30m"; export BLACK_LIGHT="\e[90m"; export GRAY_DARK="${BLACK_LIGHT}"
|
||||
export RED="\e[31m"; export RED_LIGHT="\e[91m"
|
||||
export GREEN="\e[32m"; export GREEN_LIGHT="\e[92m"
|
||||
export YELLOW="\e[33m"; export YELLOW_LIGHT="\e[93m"
|
||||
export BLUE="\e[34m"; export BLUE_LIGHT="\e[94m"
|
||||
export MAGENTA="\e[35m"; export MAGENTA_LIGHT="\e[95m"
|
||||
export CYAN="\e[36m"; export CYAN_LIGHT="\e[96m"
|
||||
export GRAY="\e[37m"; export GRAY_LIGHT="\e[97m"; export WHITE="${GRAY_LIGHT}"
|
||||
|
||||
export RESET="\e[0m"
|
||||
export BOLD="\e[1m"
|
||||
export BOLD_RESET="\e[21m"
|
||||
export DIM="\e[2m"
|
||||
export DIM_RESET="\e[22m"
|
||||
export UNDERLINE="\e[4m"
|
||||
export UNDERLINE_RESET="\e[24m"
|
||||
export INVERT="\e[7m"
|
||||
export INVERT_RESET="\e[27m"
|
||||
export BOLD="\e[1m"; export BOLD_RESET="\e[21m"
|
||||
export DIM="\e[2m"; export DIM_RESET="\e[22m"
|
||||
export UNDERLINE="\e[4m"; export UNDERLINE_RESET="\e[24m"
|
||||
export INVERT="\e[7m"; export INVERT_RESET="\e[27m"
|
||||
if [ ! -z "${1:-}" ]; then
|
||||
echo "Use the following colors to fit your needs :"
|
||||
(
|
||||
@ -852,36 +788,15 @@ if [[ ${1:-} =~ ${_regex} ]]; then
|
||||
case "$1" in
|
||||
tags) __L=1 ;;
|
||||
ls|list) __l=1 ;;
|
||||
search)
|
||||
__s=1
|
||||
__search="${@:2}"
|
||||
;;
|
||||
open)
|
||||
__o=1
|
||||
__open="${@:2}"
|
||||
;;
|
||||
add)
|
||||
__a=1
|
||||
__url="${2:-}"
|
||||
__T="${3:-}"
|
||||
__t="${4:-}"
|
||||
__A="${5:-}"
|
||||
;;
|
||||
view)
|
||||
__r=1
|
||||
__search="${@:2}"
|
||||
;;
|
||||
search) __s=1; __search="${@:2}" ;;
|
||||
open) __o=1; __open="${@:2}";;
|
||||
add) __a=1; __url="${2:-}"; __T="${3:-}"; __t="${4:-}"; __A="${5:-}";;
|
||||
view) __r=1; __search="${@:2}" ;;
|
||||
stats|statistics) __S=1 ;;
|
||||
clear) die "This now a deprecated feature. Use -d instead." ;;
|
||||
colors) __C=1;;
|
||||
help)
|
||||
usage 1
|
||||
exit 0
|
||||
;;
|
||||
version)
|
||||
echo -n "${0} v${VERSION}"
|
||||
exit 0
|
||||
;;
|
||||
help) usage 1;exit 0;;
|
||||
version) echo -n "${0} v${VERSION}";exit 0;;
|
||||
esac
|
||||
else
|
||||
# -c config file
|
||||
@ -912,87 +827,43 @@ else
|
||||
# available : ---------e-f----I-JjKk--Mm------Q-R-----Uu--W----yZ-0123456789
|
||||
while getopts ":a:A:b:c:d:G:o:P:q:r:s:t:T:w:x:BCDEFghHilLnNOpPSvVXYz" option; do
|
||||
case ${option} in
|
||||
a)
|
||||
__a=1
|
||||
__url="${OPTARG}"
|
||||
;; # Add url to bookmark
|
||||
a) __a=1; __url="${OPTARG}";; # Add url to bookmark
|
||||
A) __A="${OPTARG}";; # AcceleratoR
|
||||
b) __b="${OPTARG}";; # Bookmark file
|
||||
B) __B=1;; # Don't load the default config file
|
||||
c) __c="${OPTARG}";; # Config file
|
||||
C) __C=1;; # Print color table
|
||||
d)
|
||||
__d=1
|
||||
__del="${OPTARG}"
|
||||
;; # Config file
|
||||
d) __d=1; __del="${OPTARG}";; # Config file
|
||||
D) __D=1;; # Print color table
|
||||
E) __E=1 ;; # Open the bm.bmf file with the $EDITOR
|
||||
E) __E=1;; # Open the bm.bm file with the $EDITOR
|
||||
F) __F=1;; # Force the add or delete or picture
|
||||
g) (( __g++ ));; # generate html file(s)
|
||||
G)
|
||||
__G=1
|
||||
__file="${OPTARG}"
|
||||
;; # Generate this file (only for g=1)
|
||||
h | H)
|
||||
usage
|
||||
exit 0
|
||||
;; # Help
|
||||
G) __G=1; __file="${OPTARG}";; # Generate this file (only for g=1)
|
||||
h|H) usage; exit 0;; # Help
|
||||
i) __i=1;; # Ignore case when searching
|
||||
l) __l=1;; # List all bookmarks
|
||||
L) __L=1;; # List all tags
|
||||
n) __n=1;; # sort by date
|
||||
N) __N=1;; # sort by date (reverse)
|
||||
o)
|
||||
__o=1
|
||||
__open="${OPTARG}"
|
||||
;; # Open
|
||||
o) __o=1; __open="${OPTARG}";; # Open
|
||||
O) __O=1;; # Open First
|
||||
p) __p=1;; # Take a screenshot
|
||||
P)
|
||||
__P=1
|
||||
__search="${OPTARG}"
|
||||
;; # Take all screenshot
|
||||
q)
|
||||
__q=1
|
||||
__search="${OPTARG}"
|
||||
;; # Search
|
||||
r)
|
||||
__r=1
|
||||
__search="${OPTARG}"
|
||||
;; # Search
|
||||
s)
|
||||
__s=1
|
||||
__search="${OPTARG}"
|
||||
;; # Search
|
||||
P) __P=1; __search="${OPTARG}";; # Take all screenshot
|
||||
q) __q=1; __search="${OPTARG}";; # Search
|
||||
r) __r=1; __search="${OPTARG}";; # Search
|
||||
s) __s=1; __search="${OPTARG}";; # Search
|
||||
S) __S=1;; # Print Statistics
|
||||
t) __t="${OPTARG}";; # tags for a URL
|
||||
T) __T="${OPTARG}";; # Title for a URL
|
||||
v | V)
|
||||
echo -n "${0} v${VERSION}"
|
||||
[[ "${option}" = 'V' ]] && echo -n " [commit: ${RELEASE}]"
|
||||
echo ''
|
||||
exit 0
|
||||
;;
|
||||
v|V) echo -n "${0} v${VERSION}"; [[ "${option}" = 'V' ]] && echo -n " [commit: ${RELEASE}]"; echo ''; exit 0;;
|
||||
w) __w="${OPTARG}";; # Working directory
|
||||
x)
|
||||
__x=1
|
||||
__copy="${OPTARG}"
|
||||
;; # Copy
|
||||
x) __x=1; __copy="${OPTARG}";; # Copy
|
||||
X) __X=1;; # Copy First
|
||||
Y) __Y=1;; # Open/copy All
|
||||
z) __z=1;; # Alternative print listing
|
||||
:)
|
||||
echo "Missing argument for '-${OPTARG}'" >&2
|
||||
exit 1
|
||||
;;
|
||||
?)
|
||||
echo "Argument unknown '-${OPTARG}'" >&2
|
||||
exit 1
|
||||
;; # usage;;
|
||||
*)
|
||||
echo "Argument unknown '-${option}'" >&2
|
||||
exit 1
|
||||
;; # usage;;
|
||||
:) echo "Missing argument for '-${OPTARG}'" >&2 ; exit 1 ;;
|
||||
?) echo "Argument unknown '-${OPTARG}'" >&2 ; exit 1 ;; # usage;;
|
||||
*) echo "Argument unknown '-${option}'" >&2 ; exit 1 ;; # usage;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
@ -1013,22 +884,14 @@ config "${__c}"
|
||||
# Following config, we maybe not have to check the capture tool
|
||||
[[ ${_BM_CMD_CAPTURE_CHECK} ]] && checkBinaries "${_BM_CMD_CAPTURE}"
|
||||
|
||||
# If no bookmark file exist, create one if allowed else echo
|
||||
# If no bookmark file exist, create one if allowed
|
||||
if [ ! -f "${_BM_BOOKMARK_FILE}" -a "${_BM_CREATE_BOOKMARK_FILE,,}" = 'true' ]; then
|
||||
# Remember fields : 0=md5, 1=date, 2=accel, 3=url, 4=title, 5=tags
|
||||
# Remember fields : 1=md5, 2=date, 2=accel, 3=url, 4=title, 5=tags
|
||||
echo "eef521de8df447ad392dbace16cf2edc|$(date '+%FT%TZ')|:bm|https://github.com/The-Repo-Club/repomenu-extra/|Download link for repomenu-extra|default,shell,scripts" >> "${_BM_BOOKMARK_FILE}"
|
||||
fi
|
||||
|
||||
if [ ! -f "${_BM_BOOKMARK_FILE}" -a "${_BM_CREATE_BOOKMARK_FILE,,}" = 'false' ]; then
|
||||
echo "No current bookmark file found.";
|
||||
exit
|
||||
fi
|
||||
|
||||
# Starting to work with args. If none probably list...
|
||||
[[ ${#} -eq 0 && "${_BM_NO_ARGS_FORCE_HELP,,}" = 'true' ]] && {
|
||||
usage
|
||||
exit
|
||||
}
|
||||
[[ ${#} -eq 0 && "${_BM_NO_ARGS_FORCE_HELP,,}" = 'true' ]] && { usage ; exit; }
|
||||
|
||||
# Only one action at a time
|
||||
if [ $(( ${__a:=0} + ${__C:=0} + ${__d:=0} + ${__E:=0} + ${__g:=0} + ${__l:=0} + ${__L:=0} + ${__o:=0} + ${__P:=0} + ${__q:=0} + ${__r:=0} + ${__s:=0} + ${__S:=0} + ${__x:=0} )) -gt 1 ]; then
|
||||
@ -1043,62 +906,20 @@ if [ $((${__O:=0} + ${__Y:=0} + ${__X:=0})) -gt 1 ]; then
|
||||
fi
|
||||
|
||||
# Executing actions
|
||||
[[ ${__a} -eq 1 ]] && {
|
||||
saveUrl
|
||||
exit
|
||||
}
|
||||
[[ ${__C} -eq 1 ]] && {
|
||||
defineColors 1
|
||||
exit
|
||||
}
|
||||
[[ ${__d} -eq 1 ]] && {
|
||||
delete_bookmark "${__del}"
|
||||
exit
|
||||
}
|
||||
[[ ${__g} -ge 1 ]] && {
|
||||
bookmark_generator "${__file:=}" ''
|
||||
exit
|
||||
}
|
||||
[[ ${__l} -eq 1 ]] && {
|
||||
search
|
||||
exit
|
||||
}
|
||||
[[ ${__L} -eq 1 ]] && {
|
||||
list_tags
|
||||
exit
|
||||
}
|
||||
[[ ${__o} -eq 1 ]] && {
|
||||
open_bookmark "${__open}"
|
||||
exit
|
||||
}
|
||||
[[ ${__P} -eq 1 ]] && {
|
||||
picturize "${__search}"
|
||||
exit
|
||||
}
|
||||
[[ ${__r} -eq 1 ]] && {
|
||||
recorded_picture "${__search}"
|
||||
exit
|
||||
}
|
||||
[[ ${__q} -eq 1 ]] && {
|
||||
download_title "${__search}"
|
||||
exit
|
||||
}
|
||||
[[ ${__s} -eq 1 ]] && {
|
||||
search_bookmarks "${__search}"
|
||||
exit
|
||||
}
|
||||
[[ ${__S} -eq 1 ]] && {
|
||||
stats
|
||||
exit
|
||||
}
|
||||
[[ ${__x} -eq 1 ]] && {
|
||||
copy_bookmark "${__copy}"
|
||||
exit
|
||||
}
|
||||
[[ ${__E} -eq 1 ]] && {
|
||||
edit_bookmark
|
||||
exit
|
||||
}
|
||||
[[ ${__a} -eq 1 ]] && { saveUrl ; exit ; }
|
||||
[[ ${__C} -eq 1 ]] && { defineColors 1 ; exit ; }
|
||||
[[ ${__d} -eq 1 ]] && { delete_bookmark "${__del}"; exit ; }
|
||||
[[ ${__g} -ge 1 ]] && { bookmark_generator "${__file:=}" ''; exit ; }
|
||||
[[ ${__l} -eq 1 ]] && { search ; exit; }
|
||||
[[ ${__L} -eq 1 ]] && { list_tags ; exit; }
|
||||
[[ ${__o} -eq 1 ]] && { open_bookmark "${__open}" ; exit; }
|
||||
[[ ${__P} -eq 1 ]] && { picturize "${__search}" ; exit; }
|
||||
[[ ${__r} -eq 1 ]] && { recorded_picture "${__search}" ; exit; }
|
||||
[[ ${__q} -eq 1 ]] && { download_title "${__search}" ; exit; }
|
||||
[[ ${__s} -eq 1 ]] && { search_bookmarks "${__search}" ; exit; }
|
||||
[[ ${__S} -eq 1 ]] && { stats ; exit; }
|
||||
[[ ${__x} -eq 1 ]] && { copy_bookmark "${__copy}" ; exit; }
|
||||
[[ ${__E} -eq 1 ]] && { edit_bookmark ; exit; }
|
||||
search
|
||||
|
||||
# $Format:%cn @ %cD$ : $Id$
|
||||
|
@ -12,7 +12,7 @@
|
||||
#Created:
|
||||
# Fri 09 December 2022, 06:43:41 AM [GMT]
|
||||
#Modified:
|
||||
# Fri 09 December 2022, 08:02:52 AM [GMT]
|
||||
# Fri 14 July 2023, 11:04:29 PM [GMT+1]
|
||||
#
|
||||
#Description:
|
||||
# <Todo>
|
||||
@ -22,7 +22,7 @@
|
||||
#
|
||||
# shellcheck disable=all
|
||||
|
||||
bmFile="$HOME/.config/rofi/bookmarks/bm.bmf"
|
||||
bmFile="$HOME/.config/rofi/bookmarks/bm.bm"
|
||||
|
||||
if [[ ! -f $bmFile ]]; then
|
||||
printf "%s\n" "No current bookmark file found.";
|
||||
|
@ -12,7 +12,7 @@
|
||||
#Created:
|
||||
# Fri 09 December 2022, 06:43:30 AM [GMT]
|
||||
#Modified:
|
||||
# Fri 09 December 2022, 08:02:26 AM [GMT]
|
||||
# Fri 14 July 2023, 11:04:22 PM [GMT+1]
|
||||
#
|
||||
#Description:
|
||||
# <Todo>
|
||||
@ -22,7 +22,7 @@
|
||||
#
|
||||
# shellcheck disable=all
|
||||
|
||||
bmFile="$HOME/.config/rofi/bookmarks/bm.bmf"
|
||||
bmFile="$HOME/.config/rofi/bookmarks/bm.bm"
|
||||
|
||||
if [[ ! -f $bmFile ]]; then
|
||||
printf "%s\n" "No current bookmark file found.";
|
||||
|
Loading…
Reference in New Issue
Block a user