Untitled
unknown
plain_text
a year ago
707 B
4
Indexable
import sublime import sublime_plugin import subprocess import os class AutoPullOnLoad(sublime_plugin.EventListener): def on_load_async(self, view): file_path = view.file_name() if file_path: repo_path = self.find_git_root(file_path) if repo_path: self.git_pull(repo_path) def find_git_root(self, path): while path: if os.path.isdir(os.path.join(path, '.git')): return path parent = os.path.dirname(path) if parent == path: break path = parent return None def git_pull(self, repo_path): subprocess.run(["git", "pull"], cwd=repo_path)
Editor is loading...
Leave a Comment