diff --git a/package.json b/package.json index d8b5ad2..71106bf 100644 --- a/package.json +++ b/package.json @@ -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": [ diff --git a/src/extension.ts b/src/extension.ts index 7bf62a4..5f0902d 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -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 },