def hook(self, force=False): """ install git hook """ link("~/.lki/.pre-commit.sh", ".git/hooks/pre-commit", force=force)
def _link(src, dst=None): target = os.path.expanduser(os.path.join(HOME, dst or src)) if os.path.exists(target): os.remove(target) link(os.path.join(repo_path, src), target, force=True)
def link(self, target, link_path, force=False): """ link target to link_path """ link(target, link_path, force=force)
def hook(self, force=False, path="{}/.lki/.pre-commit.sh".format(HOME)): """install git hook""" link(path, ".git/hooks/pre-commit", force=force)