justjanne / powerline-go

A beautiful and useful low-latency prompt for your shell, written in go
GNU General Public License v3.0
2.75k stars 270 forks source link

Add option to use ssh alias instead of hostname #332

Open pedvide opened 3 years ago

pedvide commented 3 years ago

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 > ...

scop commented 2 years ago

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.