Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the preference setting logic to a function for readability. Use jq rather than grep to check for existing keys for readability. Perform modifications on a string copy of the preference file rather than piping straight back to the file. Should anything go awry, this should help prevent damaging the existing preferences file. If, for whatever reason, the preferences file is blank at the time of running this script, replace blank string with an empty dictionary `{}` to allow the following `jq` processes to succeed. Only write back to prefs file once modifications complete to avoid writing blank/invalid data to file.
- Loading branch information