diff --git a/Tips-and-Tricks.md b/Tips-and-Tricks.md index 2ac6808..ef6af9d 100644 --- a/Tips-and-Tricks.md +++ b/Tips-and-Tricks.md @@ -163,4 +163,30 @@ This works best if you use public key authentication (or GSSAPI/Kerberos authent # Automatically update your Dotbot config file when you add files in Git -You can use this tool (implemented as a Git pre-commit hook) to automatically update Dotbot's config file when adding files in Git: https://github.com/gwerbin/dotbot-autobot. \ No newline at end of file +You can use this tool (implemented as a Git pre-commit hook) to automatically update Dotbot's config file when adding files in Git: https://github.com/gwerbin/dotbot-autobot. + +# Uninstall script + +Currently, dotbot does not support uninstalling the symlinks. This scirpt is a good starting point for people who want this feature ([source](https://github.com/anishathalye/dotbot/issues/152#issuecomment-394129600)) + +```python +#!/usr/bin/env python + +from __future__ import print_function + +import yaml +import os + +CONFIG="install.conf.yaml" + +stream = open(CONFIG, "r") +conf = yaml.load(stream) + +for section in conf: + if 'link' in section: + for target in section['link']: + realpath = os.path.expanduser(target) + if os.path.islink(realpath): + print("Removing ", realpath) + os.unlink(realpath) +``` \ No newline at end of file