Skip to content
Browse files

Allow fetch type to be selected without additional menu steps

  • Loading branch information...
1 parent b09af75 commit 45e88e6f0a24b60067bf9bac06b7c0d445b321df @buymeasoda buymeasoda committed Oct 2, 2012
Showing with 22 additions and 7 deletions.
  1. +13 −3 Default.sublime-commands
  2. +9 −4 Fetch.py
View
16 Default.sublime-commands
@@ -1,10 +1,20 @@
[
{
- "caption": "Fetch",
- "command": "fetch"
+ "caption": "Fetch: File",
+ "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":
{
"file": "${packages}/User/Fetch.sublime-settings"
View
13 Fetch.py
@@ -35,14 +35,19 @@ def __init__(self, *args, **kwargs):
s.set('files', self.filesPlaceholder)
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.fileList = []
self.packageList = []
- options = ['Single file', 'Package file']
-
- self.window.show_quick_panel(options, self.callback)
+ if _type == 'single':
+ self.list_files()
+ elif _type == 'package':
+ self.list_packages()
+ else:
+ options = ['Single file', 'Package file']
+ self.window.show_quick_panel(options, self.callback)
def callback(self, index):
if not self.window.views():

0 comments on commit 45e88e6

Please sign in to comment.
Something went wrong with that request. Please try again.