Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow fetch type to be selected without additional menu steps
  • Loading branch information
buymeasoda committed Oct 2, 2012
1 parent b09af75 commit 45e88e6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
16 changes: 13 additions & 3 deletions Default.sublime-commands
@@ -1,10 +1,20 @@
[ [
{ {
"caption": "Fetch", "caption": "Fetch: File",
"command": "fetch" "command": "fetch",
"args": {
"type": "single"
}
},
{
"caption": "Fetch: Package",
"command": "fetch",
"args": {
"type": "package"
}
}, },
{ {
"caption": "Fetch: Manage remote files", "caption": "Fetch: Manage",
"command": "open_file", "args": "command": "open_file", "args":
{ {
"file": "${packages}/User/Fetch.sublime-settings" "file": "${packages}/User/Fetch.sublime-settings"
Expand Down
13 changes: 9 additions & 4 deletions Fetch.py
Expand Up @@ -35,14 +35,19 @@ def __init__(self, *args, **kwargs):
s.set('files', self.filesPlaceholder) s.set('files', self.filesPlaceholder)
sublime.save_settings('Fetch.sublime-settings') sublime.save_settings('Fetch.sublime-settings')


def run(self): def run(self, *args, **kwargs):
_type = kwargs.get('type', None)
self.s = sublime.load_settings('Fetch.sublime-settings') self.s = sublime.load_settings('Fetch.sublime-settings')
self.fileList = [] self.fileList = []
self.packageList = [] self.packageList = []


options = ['Single file', 'Package file'] if _type == 'single':

self.list_files()
self.window.show_quick_panel(options, self.callback) elif _type == 'package':
self.list_packages()
else:
options = ['Single file', 'Package file']
self.window.show_quick_panel(options, self.callback)


def callback(self, index): def callback(self, index):
if not self.window.views(): if not self.window.views():
Expand Down

0 comments on commit 45e88e6

Please sign in to comment.