-
Notifications
You must be signed in to change notification settings - Fork 0
Global and local .gitconfig get and set functions #230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…bal .gitconfig file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes are almost ready for merging. Once the requested changes have been made and pushed up, I will approve and integrate them. However, please be aware that the CI jobs failed due to some tests and snapshots needing to be updated: https://github.com/EPICLab/synectic/pull/230/checks?check_run_id=1495905949. I'll still approve the changes regardless, but if you can update the snapshots that would be helpful.
Actually, never mind about the CI test results. Apparently timestamps in Ubuntu don't default to include timezone modifiers and instead use the - Snapshot - 2
+ Received + 2
Object {
"40d14391c": Object {
"captured": false,
- "created": "2019-11-19T19:22:47.572-08:00",
+ "created": "2019-11-20T03:22:47.572-00:00",
"id": "40d14391c",
"left": 178,
"metafile": "29334943",
- "modified": "2019-11-22T12:54:11.374-08:00",
+ "modified": "2019-11-22T20:54:11.374-00:00",
"name": "card1",
"top": 540,
"type": "Editor",
},
} Tests will have to be fixed by me in another PR. |
Includes two main functions:
getConfig
returns the value of the given corresponding key path from a specified local.gitconfig
file. If this fails, it searches for the value in the global.gitconfig
file. If this fails, it returns undefined.setConfig
changes the value of the given corresponding key path. Depending on thewhich
parameter, it either writes to the local.gitconfig
file, the global.gitconfig
file, or both. If the given value is undefined, it deletes the entry.Also includes three helper functions for the above two functions:
findAllByKey
recursively finds all values within a given nested object that correspond to a given key.getGlobalGitAuthorInfo
finds the global.gitconfig
file path, then asynchronously constructs aparseGitConfig.Config
object containing all of the fields found within the global.gitconfig
file.replaceObjKey
replaces a givenparseGitConfig.Config
object key value with another given value.