Skip to content

Commit 74be57b

Browse files
committed
open in_explorer: wording on Mac OS @ cmd palette
it's a bit hackier than the side bar because .sublime-commands doesn't support the 'platform' key. We still expose only one command however, just expose open_in_explorer under two caption with an argument to hide/show on different platforms. This pattern could be extended to AppCommand if needed elsewhere. Right now it isn't. fix #18
1 parent fc5baea commit 74be57b

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

FileManager.sublime-commands

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,17 @@
1717
},
1818
{
1919
"caption": "File Manager: Open In Explorer",
20-
"command": "fm_open_in_explorer"
20+
"command": "fm_open_in_explorer",
21+
"args": {
22+
"visible_on_platforms": ["windows", "linux"]
23+
}
24+
},
25+
{
26+
"caption": "File Manager: Open In Finder",
27+
"command": "fm_open_in_explorer",
28+
"args": {
29+
"visible_on_platforms": ["osx"]
30+
}
2131
},
2232
{
2333
"caption": "File Manager: Open In Browser",

commands/open_in_explorer.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55

66
class FmOpenInExplorerCommand(AppCommand):
7-
def run(self, paths=None, *args, **kwargs):
7+
def run(self, visible_on_platforms, paths=None):
8+
# visible_on_platforms is just used by is_visible
89
self.window = get_window()
910
self.view = get_view()
1011

@@ -20,5 +21,5 @@ def run(self, paths=None, *args, **kwargs):
2021
{"dir": os.path.dirname(path), "file": os.path.basename(path)},
2122
)
2223

23-
def is_visisble(self, **args):
24-
return True
24+
def is_visible(self, visible_on_platforms, paths=None):
25+
return sublime.platform() in visible_on_platforms and super().is_visible()

0 commit comments

Comments
 (0)