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