justjanne / powerline-go

A beautiful and useful low-latency prompt for your shell, written in go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add option to use ssh alias instead of hostname

pedvide opened this issue · comments

Is your feature request related to a problem? Please describe.
In my job, I ssh into a set of machines I have ssh aliases for. The hostnames can be quite long and not informative.

Describe the solution you'd like
I have short and informative ssh aliases set up for those machines. I'd like to see them instead of the hostname in my prompt. Eg:
instead of username > long-uninformative-hostname > ..., I'd like username > my-server > ...

While I see how this would be useful, I'm not aware of a way powerline-go could do this on its own, as ssh doesn't send the alias you were using to the remote side where the prompt gets rendered.

If one is willing to go through some trouble for this and has necessary permissions, I guess this could be done is by configuring the ssh client to set an environment variable to the value desired to be rendered at the remote end when accessed with your alias, making sure that the remote sshd is configured to accept that environment variable, and configuring the remote powerline-go to display a segment with that variable with -shell-var/-shell-var-no-warn-empty.