mirror of
https://github.com/RyanGreenup/cadmus.git
synced 2025-08-01 11:50:16 +02:00
[FEAT]: Global Preview with QR Code
This commit is contained in:
28
bin/cadmus
28
bin/cadmus
@@ -55,7 +55,7 @@ function mainHelp() {
|
||||
echo -e " ⎋ \e[1;36m convert \e[0m \e[1;34m ┊┊┊ 📁\e[0m Convert Clipboard Contents to Different Formats "
|
||||
echo -e " 🧰 \e[1;37m misc \e[0m \e[1;34m ┊┊┊ 📁\e[0m Miscelanneous Tools nice to have on hand "
|
||||
echo -e " 🌏\e[1;92m publish\e[0m \e[1;34m ┊┊┊ 📁\e[0m Publish with \e[1;34m \e[4m\e[3mMkDocs\e[0m\e[0m🐍"
|
||||
echo -e " 🕮 \e[1;93m preview \e[0m \e[1;34m ┊┊┊ 🎆\e[0m Preview with \e[1;34m \e[4m\e[3mMarkServ\e[0m\e[0m (use chrome for this)"
|
||||
echo -e " 🕮 \e[1;93m preview \e[0m \e[1;34m ┊┊┊ 🎆\e[0m Preview with \e[1;34m \e[4m\e[3mMarkServ\e[0m\e[0m (use 'preview!' for global)"
|
||||
echo -e " 🕮 \e[1;94m help \e[0m \e[1;34m ┊┊┊ 🎆\e[0m Open help for correspoding functions "
|
||||
echo
|
||||
echo -e " \e[3m\e[1m• Legend\e[0m "
|
||||
@@ -94,6 +94,8 @@ arguments () {
|
||||
;;
|
||||
preview) shift; cd "${NOTES_DIR}" && markserv || echo -e " \n \e[1;34m maybe fix this with:\n\tsudo fuser 35729/tcp -k \n \tor\n\tkillall markserv \e[0m\n"
|
||||
;;
|
||||
preview!) shift; previewGlobal
|
||||
;;
|
||||
help) subHelp && exit 0
|
||||
;;
|
||||
--*) >&2 echo "bad option $1"
|
||||
@@ -294,7 +296,7 @@ makeNewNote () {
|
||||
echo -e "Please Choose Relevant Tags (Use Tab for Multi Select)"
|
||||
echo -e "\n\t(Press any key to continue)"
|
||||
read -d '' -s -n1 choice
|
||||
|
||||
|
||||
## Choose Tags
|
||||
TAGS="$(node "${script_dir}"/tags/yaml-parse.js "${NOTES_DIR}" 2>/dev/null | sort -u| sk -m)"
|
||||
|
||||
@@ -526,6 +528,28 @@ CadmusConvert () {
|
||||
|
||||
}
|
||||
|
||||
# *** Preview Global
|
||||
previewGlobal() {
|
||||
MARKSERVPORT="28754"
|
||||
cd "${NOTES_DIR}"
|
||||
printQR
|
||||
markserv -p "${MARKSERVPORT}" -a 0.0.0.0 || echo -e " \n \e[1;34m maybe fix this with:\n\tsudo fuser 35729/tcp -k \n \tor\n\tkillall markserv \e[0m\n"
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
# **** Print QR
|
||||
printQR () {
|
||||
command -v qrencode >/dev/null 2>&1 || { echo -e >&2 "I require qrencode but it's not installed.\nNo QR Code can be printed."; return; }
|
||||
command -v ip >/dev/null 2>&1 || { echo -e >&2 "I requre ip but it's not installed.\nNo QR Code can be printed."; return; }
|
||||
|
||||
CURRENTIP="$(ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p')"
|
||||
qrencode -t UTF8 "http://${CURRENTIP}:${MARKSERVPORT}"
|
||||
|
||||
}
|
||||
|
||||
# **** Help
|
||||
function ConvertHelp () {
|
||||
|
||||
|
Reference in New Issue
Block a user