From f83e959c58caa9557d42e7c5a0cfe3e791b46f4a Mon Sep 17 00:00:00 2001 From: Gerard Roche Date: Sun, 27 Aug 2017 08:18:33 +0100 Subject: [PATCH] Internal: Refactor: Sort commands --- CHANGELOG.md | 3 ++- plugin.py | 58 ++++++++++++++++++++++++++-------------------------- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a3bd70..96b0908 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. -## Unreleased +## [1.6.0] - 2017-08-27 ### Added @@ -174,6 +174,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt * Initial import +[1.6.0]: https://github.com/gerardroche/sublime-open-sesame/compare/1.5.7...1.6.0 [1.5.7]: https://github.com/gerardroche/sublime-open-sesame/compare/1.5.6...1.5.7 [1.5.6]: https://github.com/gerardroche/sublime-open-sesame/compare/1.5.5...1.5.6 [1.5.5]: https://github.com/gerardroche/sublime-open-sesame/compare/1.5.4...1.5.5 diff --git a/plugin.py b/plugin.py index 4f23b07..47159e5 100644 --- a/plugin.py +++ b/plugin.py @@ -14,35 +14,6 @@ from sublime_plugin import WindowCommand -class OpenSesameOpenProjectCommand(WindowCommand): - - def run(self, path=None, *args, **kwargs): - self.folders = _find_folders(path) - if self.folders: - self.window.show_quick_panel(self.folders, self.on_done) - else: - _status_message('no projects found') - - def on_done(self, index): - if index == -1: - return - - folder = self.folders[index][1] - folder_projects = glob.glob(folder + '/*.sublime-project') - - if len(folder_projects) == 1 and os.path.isfile(folder_projects[0]): - _subl_open_project_in_new_window(folder_projects[0]) - elif os.path.isdir(folder): - _subl_open_folder_in_new_window(folder) - - -# DEPRECATED Remove in v2.0.0 -class OpenSesameCommand(OpenSesameOpenProjectCommand): - def run(self, *args, **kwargs): - _message('***DEPRECATED*** \'open_sesame\' command is deprecated; use \'open_sesame_open_project\'') - super().run(*args, **kwargs) - - class OpenSesameAddProjectCommand(WindowCommand): def run(self, path=None, *args, **kwargs): @@ -88,6 +59,35 @@ def run(self, *args, **kwargs): super().run(*args, **kwargs) +class OpenSesameOpenProjectCommand(WindowCommand): + + def run(self, path=None, *args, **kwargs): + self.folders = _find_folders(path) + if self.folders: + self.window.show_quick_panel(self.folders, self.on_done) + else: + _status_message('no projects found') + + def on_done(self, index): + if index == -1: + return + + folder = self.folders[index][1] + folder_projects = glob.glob(folder + '/*.sublime-project') + + if len(folder_projects) == 1 and os.path.isfile(folder_projects[0]): + _subl_open_project_in_new_window(folder_projects[0]) + elif os.path.isdir(folder): + _subl_open_folder_in_new_window(folder) + + +# DEPRECATED Remove in v2.0.0 +class OpenSesameCommand(OpenSesameOpenProjectCommand): + def run(self, *args, **kwargs): + _message('***DEPRECATED*** \'open_sesame\' command is deprecated; use \'open_sesame_open_project\'') + super().run(*args, **kwargs) + + class OpenSesameRemoveFolderCommand(WindowCommand): def run(self, *args, **kwargs):