minor
This commit is contained in:
@@ -7,26 +7,32 @@ path=$(dirname "$(readlink -f "$0")")
|
||||
|
||||
file="$path"/../posh_theme.omp.json
|
||||
|
||||
targetTypes='["os", "session", "status"]'
|
||||
targetTypes=("os" "session" "status")
|
||||
|
||||
python3 <<EOF
|
||||
if ! python3 - "$file" "$colorHex" "${targetTypes[@]}"; then {
|
||||
log_error "Failed to edit ${file}"
|
||||
exit 1
|
||||
} fi <<EOF
|
||||
import json
|
||||
import sys
|
||||
|
||||
data = None
|
||||
file = sys.argv[1]
|
||||
colorHex = sys.argv[2]
|
||||
targetTypes = sys.argv[3:]
|
||||
|
||||
with open("$file", "r") as f:
|
||||
with open(file, "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
def processSegments(segments):
|
||||
for segment in segments:
|
||||
if "type" in segment and segment["type"] in $targetTypes:
|
||||
if "type" in segment and segment["type"] in targetTypes:
|
||||
if "foreground" in segment:
|
||||
segment["foreground"] = "#$colorHex"
|
||||
segment["foreground"] = f"#{colorHex}"
|
||||
|
||||
def processTransientPrompt(transientPrompt):
|
||||
if "foreground" in transientPrompt:
|
||||
transientPrompt["foreground"] = "#$colorHex"
|
||||
transientPrompt["foreground"] = f"#{colorHex}"
|
||||
|
||||
def process(obj):
|
||||
if isinstance(obj, dict):
|
||||
@@ -44,7 +50,7 @@ with open("$file", "r") as f:
|
||||
process(data)
|
||||
|
||||
if data is not None:
|
||||
with open("$file", "w") as f:
|
||||
with open(file, "w") as f:
|
||||
json.dump(data, f, indent=4)
|
||||
EOF
|
||||
|
||||
|
||||
Reference in New Issue
Block a user