Update readme and rename output to library
This commit is contained in:
+11
-11
@@ -95,15 +95,15 @@ update_json() {
|
||||
JSON_OUTPUT+="}"
|
||||
|
||||
# JSON speichern
|
||||
echo -e "$JSON_OUTPUT" > output.json
|
||||
echo -e "$JSON_OUTPUT" > library.json
|
||||
|
||||
echo "Daten gespeichert in output.json"
|
||||
echo "Daten gespeichert in library.json"
|
||||
}
|
||||
|
||||
# Funktion zum Auflisten der Ordnernamen
|
||||
list_folder_names() {
|
||||
if [ -f "output.json" ]; then
|
||||
folder_names=$(jq -r '.folders[].name' output.json)
|
||||
if [ -f "library.json" ]; then
|
||||
folder_names=$(jq -r '.folders[].name' library.json)
|
||||
if [ -n "$folder_names" ]; then
|
||||
echo "Ordnernamen:"
|
||||
echo "$folder_names"
|
||||
@@ -111,7 +111,7 @@ list_folder_names() {
|
||||
echo "Keine Ordnernamen im JSON gefunden."
|
||||
fi
|
||||
else
|
||||
echo "Die Datei output.json existiert nicht."
|
||||
echo "Die Datei library.json existiert nicht."
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -122,12 +122,12 @@ search_folder() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "output.json" ]; then
|
||||
echo "Die Datei output.json existiert nicht."
|
||||
if [ ! -f "library.json" ]; then
|
||||
echo "Die Datei library.json existiert nicht."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
results=$(jq -r --arg search "$2" '.folders[].name | select(test($search; "i"))' output.json)
|
||||
results=$(jq -r --arg search "$2" '.folders[].name | select(test($search; "i"))' library.json)
|
||||
|
||||
if [ -z "$results" ]; then
|
||||
echo "Keine passenden Ordner gefunden."
|
||||
@@ -152,15 +152,15 @@ download_file() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "output.json" ]; then
|
||||
echo "Die Datei output.json existiert nicht."
|
||||
if [ ! -f "library.json" ]; then
|
||||
echo "Die Datei library.json existiert nicht."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Wenn DOWNLOAD_LOCATION nicht gesetzt, nach dem Zielordner fragen
|
||||
DOWNLOAD_LOCATION=${DOWNLOAD_LOCATION:-$(read -p "Bitte Zielordner für den Download angeben (Standard: .): " loc; echo ${loc:-.})}
|
||||
|
||||
results=$(jq -r --arg search "$2" '.folders[] | select(.name | test($search; "i"))' output.json)
|
||||
results=$(jq -r --arg search "$2" '.folders[] | select(.name | test($search; "i"))' library.json)
|
||||
|
||||
if [ -z "$results" ]; then
|
||||
echo "Keine passenden Dateien gefunden."
|
||||
|
||||
Reference in New Issue
Block a user