From 4cd34ee2bc043b597eda7c02db57322739b7cfce Mon Sep 17 00:00:00 2001 From: Estelle Poulin Date: Wed, 24 Apr 2019 14:18:41 -0400 Subject: [PATCH] Add ZSH function --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 85b999b..811ddfc 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,22 @@ directory and then do whatever with the `parse-ssh-cl` binary it spits out. As far as dependencies go just about any distribution's development tools should be more than enough to build and use. It pretty just uses libc. +How do you actually use it in your shell? Anyone who is this deep in shell +customization uses ZSH, right? + +``` +ssh() { + if [[ -n "$TMUX" ]]; then + cur="$(tmux display-message -p '#W')" + tmux rename-window $(parse-ssh-cl "$@" | awk '/^Host/ { print $2; }') + command ssh "$@" + tmux rename-window "$cur" + else + exec command ssh "$@" + fi +} +``` + ## Never Asked Questions. Do you support `-l` and `-p` parsing? Not yet. That's a great idea me.