Add disconnectAll command (closes #144)

feature/ssh-config
Kelvin Schoofs 4 years ago
parent 0213a25979
commit 70d38eec1b

@ -18,6 +18,7 @@
"onCommand:sshfs.new",
"onCommand:sshfs.add",
"onCommand:sshfs.disconnect",
"onCommand:sshfs.disconnectAll",
"onCommand:sshfs.terminal",
"onCommand:sshfs.focusTerminal",
"onCommand:sshfs.closeTerminal",
@ -96,6 +97,12 @@
"category": "SSH FS",
"icon": "$(debug-disconnect)"
},
{
"command": "sshfs.disconnectAll",
"title": "Disconnect all",
"category": "SSH FS",
"icon": "$(debug-disconnect)"
},
{
"command": "sshfs.terminal",
"title": "Open remote SSH terminal",
@ -166,9 +173,13 @@
"group": "SSH FS@6"
},
{
"command": "sshfs.settings",
"command": "sshfs.disconnectAll",
"group": "SSH FS@7"
},
{
"command": "sshfs.settings",
"group": "SSH FS@8"
},
{
"command": "sshfs.focusTerminal",
"when": "false"
@ -191,17 +202,22 @@
{
"command": "sshfs.new",
"when": "view == 'sshfs-configs'",
"group": "navigation@1"
"group": "navigation@2"
},
{
"command": "sshfs.add",
"when": "view == 'sshfs-connections'",
"group": "navigation@2"
},
{
"command": "sshfs.disconnectAll",
"when": "view == 'sshfs-connections'",
"group": "navigation@3"
},
{
"command": "sshfs.settings",
"when": "view == 'sshfs-configs' || view == 'sshfs-connections'",
"group": "navigation@3"
"group": "navigation@100"
}
],
"view/item/context": [

@ -83,6 +83,13 @@ export function activate(context: vscode.ExtensionContext) {
handleConnection: con => manager.commandDisconnect(con),
});
// sshfs.disconnectAll()
registerCommand('sshfs.disconnectAll', () => {
const conns = manager.connectionManager;
// Does not close pending connections (yet?)
conns.getActiveConnections().forEach(conn => conns.closeConnection(conn, 'command:disconnectAll'));
});
// sshfs.termninal(target?: string | FileSystemConfig | Connection | vscode.Uri)
registerCommandHandler('sshfs.terminal', {
promptOptions: { promptConfigs: true, promptConnections: true },

Loading…
Cancel
Save