Files
PromptArch/fix_device_array.py

18 lines
623 B
Python

#!/usr/bin/env python3
fp = '/home/uroma/promptarch/components/AIAssist.tsx'
with open(fp, 'r') as f:
content = f.read()
# Fix the array that lost all its quotes
old = '{([[full, Full], [desktop, Desktop], [tablet, Tablet], [mobile, Mobile]] as const).map(([size, label]) => ('
new = '{([["full", "Full"], ["desktop", "Desktop"], ["tablet", "Tablet"], ["mobile", "Mobile"]] as const).map(([size, label]) => ('
if old in content:
content = content.replace(old, new, 1)
print('Fixed array quotes')
else:
print('WARNING: Could not find array')
with open(fp, 'w') as f:
f.write(content)