OK, I am not familiar with Python, but after some research I made a simple exec
wrapper.
That’s how I make it work on macOS.
Cd into: ~/Library/Application Support/Sublime Text 3/Packages/User
.
Create a file execa.py
:
import os
import sublime
import sublime_plugin
class ExecaCommand(sublime_plugin.WindowCommand):
def run(self, paths=[], cmd=""):
if not cmd:
sublime.error_message("ExecaCommand: Please provide \"cmd\" argument")
return
shell_cmd = cmd
if len(paths) > 0:
safe_paths = ["\"" + i + "\"" for i in paths]
shell_cmd = cmd + " " + " ".join(safe_paths)
cwd = os.path.dirname(paths[0])
self.window.run_command("exec", {
"shell_cmd": shell_cmd,
"working_dir": cwd
})
Then, create a file Side Bar.sublime-menu
:
[
{
"caption": "Optimizt",
"children": [
{
"caption": "Optimize Images",
"command": "execa",
"args": {
"paths": [],
"cmd": "optimizt --verbose",
}
},
{
"caption": "Create WebP",
"command": "execa",
"args": {
"paths": [],
"cmd": "optimizt --webp --verbose"
}
}
]
}
]
And now I able to run any command with provided paths 


Hope someone finds this useful.