Skip to content

Commit 536a633

Browse files
Command option to open project
Integration of the PR on Randy3k's repository (randy3k#97) + Modifications to specify the workspace to open
1 parent 692db2b commit 536a633

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

project_manager.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1369,13 +1369,33 @@ def on_window_command(self, window, command_name, args):
13691369
class ProjectManagerCommand(sublime_plugin.WindowCommand):
13701370
manager = None
13711371

1372-
def run(self, action=None, caller=None):
1372+
def run(self, action=None, caller=None, project=None, workspace=None):
13731373
self.caller = caller
13741374

13751375
if not self.manager:
13761376
self.manager = Manager(self.window)
13771377
self.manager.refresh_curr_project()
13781378

1379+
if project is not None:
1380+
pinfos = self.manager.projects_info.info()
1381+
if project not in pinfos:
1382+
sublime.status_message("Project '{}' does not exist".format(project))
1383+
return
1384+
1385+
if workspace is None:
1386+
self.manager.open_in_new_window(project)
1387+
return
1388+
1389+
wfiles = pinfos[project]["workspaces"]
1390+
wnames = [os.path.basename(re.sub(r'\.sublime-workspace$', '', wfile))
1391+
for wfile in wfiles]
1392+
if workspace in wnames:
1393+
self.manager.open_in_new_window(project, wfiles[wnames.index(workspace)])
1394+
else:
1395+
sublime.status_message("Workspace '{}' does not exist in project '{}'"
1396+
.format(workspace, project))
1397+
return
1398+
13791399
if action is None:
13801400
self.show_options()
13811401
return

0 commit comments

Comments
 (0)