77 lines
1.8 KiB
Bash
77 lines
1.8 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
## Vérification si dialog est installé
|
||
|
if [ ! -f /usr/bin/dialog ] && [ ! -f /data/data/com.termux/files/usr/bin/dialog ]; then echo -e "\ndialog n'est pas installé.\n"; exit; fi
|
||
|
|
||
|
## chemin vers les quickmarks
|
||
|
QMFILE=~/Sync/Conf/qb/quickmarks
|
||
|
|
||
|
## dialog 1 - filtre
|
||
|
HEIGHT=15
|
||
|
WIDTH=40
|
||
|
CHOICE_HEIGHT=4
|
||
|
BACKTITLE="QuteBrowser QuickMarks Browser"
|
||
|
TITLE="QBQMB"
|
||
|
MENU="Appliquer un filtre ?"
|
||
|
|
||
|
OPTIONS=(1 "Oui"
|
||
|
2 "Non")
|
||
|
|
||
|
CHOICE=$(dialog --clear \
|
||
|
--backtitle "$BACKTITLE" \
|
||
|
--title "$TITLE" \
|
||
|
--menu "$MENU" \
|
||
|
$HEIGHT $WIDTH $CHOICE_HEIGHT \
|
||
|
"${OPTIONS[@]}" \
|
||
|
2>&1 >/dev/tty)
|
||
|
|
||
|
clear
|
||
|
case $CHOICE in
|
||
|
1)
|
||
|
echo "Saisir un filtre"
|
||
|
# Saisir filtre via un read puis le réutiliser dans dialog 2
|
||
|
;;
|
||
|
2)
|
||
|
# définition de $QM dont chaque array correspond à une ligne de $QMFILE
|
||
|
mapfile -t QM <$QMFILE
|
||
|
# awk '{print $NF}' Sync/Conf/qb/quickmarks
|
||
|
# echo "${test##* }"
|
||
|
read
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
## dialog 2 - quickmarks
|
||
|
HEIGHT=15
|
||
|
WIDTH=40
|
||
|
CHOICE_HEIGHT=10
|
||
|
TITLE="QBQMB"
|
||
|
MENU="Choisir un quickmark:"
|
||
|
|
||
|
# ICI TROUVER comment récuperer la liste des quickmarks, peut etre avec un for
|
||
|
OPTIONS=(1 "Option 1"
|
||
|
2 "Option 2"
|
||
|
3 "Option 3")
|
||
|
|
||
|
CHOICE=$(dialog --clear \
|
||
|
--backtitle "$BACKTITLE" \
|
||
|
--title "$TITLE" \
|
||
|
--menu "$MENU" \
|
||
|
$HEIGHT $WIDTH $CHOICE_HEIGHT \
|
||
|
"${OPTIONS[@]}" \
|
||
|
2>&1 >/dev/tty)
|
||
|
|
||
|
clear
|
||
|
# ICI trouver un moyen d'exploiter les quickmarks trouvés (voir matrice variable bash?)
|
||
|
case $CHOICE in
|
||
|
1)
|
||
|
echo "You chose Option 1"
|
||
|
;;
|
||
|
2)
|
||
|
echo "You chose Option 2"
|
||
|
;;
|
||
|
3)
|
||
|
echo "You chose Option 3"
|
||
|
;;
|
||
|
esac
|