From 6ecabb9ffaea97a853269d128a19a3950ee44c2c Mon Sep 17 00:00:00 2001 From: Bruno21 Date: Mon, 14 Oct 2024 09:25:55 +0200 Subject: [PATCH] v 0.9.1 --- bashbirds.sh | 52 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/bashbirds.sh b/bashbirds.sh index bc92d86..8f52442 100755 --- a/bashbirds.sh +++ b/bashbirds.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERSION="v0.9" +VERSION="v0.8" red="\033[1;31m" greenbold="\033[1;32m" @@ -15,13 +15,13 @@ reset="\033[0m" dotenv () { set -a # shellcheck disable=SC1091 - [ -f ".env" ] && . ".env" || echo -e "${red}\nNo .env file found ! No token for gotify.${reset}" + [ -f ".env" ] && . ".env" || echo -e "${red}\nNo .env file found ! Could'nt get update from Github.'.${reset}" set +a } dotenv -### ChangeNotes: . +### ChangeNotes: Minor corrections. Github="https://github.com/bruno21/bashbirds" # Repo normal: #RawUrl="https://raw.githubusercontent.com/Bruno21/bashbirds/main/bashbirds.sh" @@ -36,7 +36,8 @@ ScriptWorkDir="$(dirname "$ScriptPath")" # /Users/bruno/Documents/Scripts/bashbi ### Check if there's a new release of the script: LatestRelease="$(curl -s -r 0-50 $RawUrl | sed -n "/VERSION/s/VERSION=//p" | tr -d '"')" LatestChanges="$(curl -s -r 0-200 $RawUrl | sed -n "/ChangeNotes/s/### ChangeNotes: //p")" -echo $LatestRelease +#[[ $LatestRelease != $VERSION ]] && new="($LatestRelease)" || new="" + echo -e "${yellowbold}Bashbird${reset} $VERSION\n" @@ -74,16 +75,28 @@ req2() { [[ $aut != "" ]] && z="($aut)" || z="" if [ $ext = ".md" ]; then - echo "| $fr $z |" >>"$f" - echo "|--------------------------------------------------|" >>"$f" - echo "| $lat |" >> "$f" - echo "| $en |" >> "$f" - echo "| $or |" >> "$f" - echo "| $fa |" >> "$f" - echo "| $ln |" >> "$f" - echo "" >> "$f" + + #echo "| $fr $z |" >>"$f" + #echo "|--------------------------------------------------|" >>"$f" + #echo "| $lat |" >> "$f" + #echo "| $en |" >> "$f" + #echo "| $or |" >> "$f" + #echo "| $fa |" >> "$f" + #echo "| $ln |" >> "$f" + #echo "" >> "$f" + + bird+="| $fr $z |\n" + bird+="|--------------------------------------------------|\n" + bird+="| $lat |\n" + bird+="| $en |\n" + bird+="| $or |\n" + bird+="| $fa |\n" + bird+="| $ln |\n" + bird+=" \n" + elif [ $ext = ".html" ]; then - firstletter="${fr:0:1}" + + firstletter="${fr:0:1}" if [ $firstletter != $old_index ]; then index+=("$firstletter") @@ -116,12 +129,19 @@ req2() { bird="$z" html + elif [ $ext = ".md" ]; then + + echo -e "${yellow}Exporting markdown file...${reset}" + echo "$bird" > "liste_oiseaux$ext" fi exit 0 } html() { + +echo -e "${yellow}Exporting html file...${reset}" + cat > liste_oiseaux.html << EOF @@ -222,7 +242,11 @@ req1() { request=""; fi - query1="SELECT * FROM liste WHERE Francais LIKE \"%$request%\" OR Autres LIKE \"%$request%\" OR Latin LIKE \"%$request%\""; + # COLLATE NOCASE, COLLATE UNICODE + # SELECT column FROM table WHERE UNICODE(column) = UNICODE('café'); + query1="SELECT * FROM liste WHERE Francais LIKE \"%$request%\" OR Autres LIKE \"%$request%\" OR Latin LIKE \"%$request%\" COLLATE NOACCENTS"; + #query1="SELECT * FROM liste WHERE UNICODE(Francais) = UNICODE('$request')"; # OR Autres LIKE \"%$request%\" OR Latin LIKE \"%$request%\""; + echo "$query1" result1=$(sqlite3 ./birds.db "$query1") if [ -n "$result1" ]; then