Created
January 10, 2018 16:57
Python script to find a .sublime-project file in the current directory and launch the project in Sublime Text.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import subprocess | |
cwd = os.getcwd() | |
file_list = [f for f in os.listdir(cwd) if f.endswith('.sublime-project')] | |
fl_len = len(file_list) | |
if fl_len == 0: | |
print("sublime-project file not found") | |
elif fl_len == 1: | |
print("opening: {}".format(file_list[0])) | |
subprocess.run(["/usr/bin/subl", "--project", file_list[0]]) | |
else: | |
print("error: multiple sublime-project files found") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment