-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Persisting CodeEditor settings across app restarts (#544)
- Loading branch information
1 parent
334343d
commit 77c360f
Showing
3 changed files
with
67 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import json | ||
from sys import argv | ||
|
||
|
||
# merges json files file1 and file2, keys in file2 overwriting any keys that already exist in file1 | ||
def main(): | ||
file1, file2 = argv[1], argv[2] | ||
# Read JSON data from files | ||
with open(file1, "r") as f1, open(file2, "r") as f2: | ||
data1 = json.load(f1) | ||
data2 = json.load(f2) | ||
|
||
# Merge the data (simple update) | ||
merged_data = {**data1, **data2} | ||
|
||
# Write the merged data to a new file | ||
with open(file1, "w") as f: | ||
json.dump(merged_data, f) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters