I’m trying to create a right-click context menu for the sidebar that that allows me to open terminal with SSH command with variables from .sftp-config files.
First, context menu should be visible only on .sftp-config files, i cant find any command for realize that in https://www.sublimetext.com/docs/menus.html
that is what i have:
File: ~/Library/Application Support/Sublime Text/Packages/User/Side Bar.sublime-menu
[
{
“caption”: “Open SSH”,
“command”: “open_ssh”, “args”: {“files”: []}
},
]
I put file ~/Library/Application Support/Sublime Text/Packages/User/OpenSsh.py
with code
import sublime
import sublime_plugin
class OpenSshCommand(sublime_plugin.WindowCommand):
def run(self, files):
# Make command visible only when there is a single file
def is_visible(self, files):
return len(files) == 1
How can I make the command parse the .sftp-config file and open the terminal with variables
ssh $user@$host -p $port
.sftp-config example:
{
…
“host”: “123.123.123.123”,
“user”: “username”,
“port”: “22”,
…
}
Is it possible?