Skip to content

Commit

Permalink
add sidebar action
Browse files Browse the repository at this point in the history
  • Loading branch information
braver committed Jul 8, 2017
1 parent cbd676f commit 923c95e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Side Bar.sublime-menu
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"id": "SublimeGitUp", "caption": "-"
},
{
"caption": "Open in GitUp",
"command": "side_bar_gitup",
"args": { "paths": [] }
}
]
23 changes: 23 additions & 0 deletions SublimeGitUp.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,26 @@ def run(self, *args):

app_path = '/Applications/GitUp.app'
subprocess.call(['open', '-a', app_path, path])

class SideBarGitupCommand(sublime_plugin.WindowCommand):

def is_enabled(self):
return True

def get_path(self, paths):
try:
return paths[0]
except IndexError:
return self.window.active_view().file_name()

def run(self, paths):
sublime.status_message('GitUp: running')
path = self.get_path(paths)
if not path:
sublime.status_message('GitUp: No path')
return False
if os.path.isfile(path):
path = os.path.dirname(path)

app_path = '/Applications/GitUp.app'
subprocess.call(['open', '-a', app_path, path])

0 comments on commit 923c95e

Please sign in to comment.