vaporup / ssh-tools

Making SSH more convenient
GNU General Public License v3.0
889 stars 27 forks source link

ssh-ping mit Autovervollständigung #14

Closed lachenmeiers closed 1 year ago

lachenmeiers commented 2 years ago

Hallo Verdampfen,

Kann du bitte in SSH-Ping von den SSH-Config die Hosts Eintrage nehmen wie auch von der known_hosts Datei? War mega, wenn dies gehen würde.

vaporup commented 2 years ago

Not a final solution, but a quick workaround to use existing completions

Bash

can be put into your local Bash config

complete -F _ssh ssh-ping
ssh TAB-TAB      # see why: https://stackoverflow.com/a/61544119

ssh-ping TAB-TAB
vaporup commented 2 years ago

Ubuntu (and maybe others) ship completions which can be used.

Bash

complete -F _known_hosts ssh-ping

Zsh

compdef _ssh_hosts ssh-ping

Fish

complete -c ssh-ping -a "(__fish_print_hostnames)"
bforpc commented 2 years ago

Why i cant leave a new issue?

Pong with Ip address: it will be nice to know the ip of the ping'ing server. In most time when using completition, you dont know the ip (therefore you use it :-) ), only the name of the host.

So please print also the ip of the pinging host on cli.

Bfo

vaporup commented 2 years ago

I don't think there is a reliable way to get this information. You can't rely on DNS especially not if you go through Jump hosts. So ssh-ping needs to get this info from the target system itself. But that means it has to run some shell code which has to be very portable and also sophisticated because possibly there are many interfaces etc...

So, I am not going to implement this until someone knows a very simple solution.