1
0
forked from finn/tinyboard

syncthing.sh: fix Python f-string backslash escaping in all python3 -c blocks

This commit is contained in:
Justin Oros
2026-04-18 18:42:00 -07:00
parent 866f8af073
commit b2932286d0

View File

@@ -126,8 +126,8 @@ if not devices:
print(" No devices configured.")
else:
for d in devices:
print(f" Name: {d[\"name\"]}")
print(f" ID: {d[\"deviceID\"]}")
print(" Name: " + d["name"])
print(" ID: " + d["deviceID"])
print()
'
}
@@ -169,7 +169,7 @@ remove_device() {
echo "$devices" | python3 -c '
import sys, json
for i, d in enumerate(json.load(sys.stdin), 1):
print(f" {i}) {d[\"name\"]} — {d[\"deviceID\"]}")
print(" " + str(i) + ") " + d["name"] + " — " + d["deviceID"])
'
echo ""
read -rp "Choose device to remove [1-${count}]: " CHOICE
@@ -211,11 +211,11 @@ if not folders:
else:
for f in folders:
label = f["label"] or f["id"]
shared = [d["deviceID"][:8]+"..." for d in f.get("devices", [])]
print(f" Label: {label}")
print(f" ID: {f[\"id\"]}")
print(f" Path: {f[\"path\"]}")
print(f" Shared: {len(shared)} device(s)")
shared = len(f.get("devices", []))
print(" Label: " + label)
print(" ID: " + f["id"])
print(" Path: " + f["path"])
print(" Shared: " + str(shared) + " device(s)")
print()
'
}
@@ -287,7 +287,7 @@ share_folder() {
import sys, json
for i, f in enumerate(json.load(sys.stdin), 1):
label = f["label"] or f["id"]
print(f" {i}) {label}")
print(" " + str(i) + ") " + label)
'
echo ""
read -rp "Choose folder [1-${f_count}]: " F_CHOICE
@@ -298,7 +298,7 @@ for i, f in enumerate(json.load(sys.stdin), 1):
echo "$devices" | python3 -c '
import sys, json
for i, d in enumerate(json.load(sys.stdin), 1):
print(f" {i}) {d[\"name\"]}")
print(" " + str(i) + ") " + d["name"])
'
echo ""
read -rp "Choose device [1-${d_count}]: " D_CHOICE
@@ -345,7 +345,7 @@ import sys, json
for i, f in enumerate(json.load(sys.stdin), 1):
label = f["label"] or f["id"]
shared = len(f.get("devices", []))
print(f" {i}) {label} ({shared} device(s))")
print(" " + str(i) + ") " + label + " (" + str(shared) + " device(s))")
'
echo ""
read -rp "Choose folder [1-${f_count}]: " F_CHOICE