Created
March 24, 2023 04:37
-
-
Save dohq/164de7bc95de765d9b3202d401b4549d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fzf-ssh-consul () { | |
local selected_host=$(consul catalog nodes | grep -v "DC" | awk '{print $1}' | fzf --query "$LBUFFER" --prompt="Consul Nodes SSH Remote > ") | |
if [ -n "$selected_host" ]; then | |
BUFFER="ssh ${selected_host}.node.consul" | |
zle accept-line | |
fi | |
zle reset-prompt | |
} | |
zle -N fzf-ssh-consul | |
bindkey '^f' fzf-ssh-consul |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment