Have *_with_cwd work with the ssh kitten to open new windows auto-logged into the remote server at the current remote working directory

This commit is contained in:
Kovid Goyal
2022-03-15 19:59:16 +05:30
parent a216f6bd46
commit ce1e22ac95
6 changed files with 63 additions and 5 deletions

View File

@@ -936,3 +936,12 @@ def cleanup_ssh_control_masters() -> None:
for x in files:
with suppress(OSError):
os.remove(x)
def path_from_osc7_url(url: str) -> str:
if url.startswith('kitty-shell-cwd://'):
return '/' + url.split('/', 3)[-1]
if url.startswith('file://'):
from urllib.parse import urlparse
return urlparse(url).path
return ''