pub fn ssh_host(argv: &str) -> Option<String>Expand description
The host an ssh … tmux … argv connects to, or None.
Finds the ssh token, then takes the first bare word after it as the host,
skipping options and the values of the ones that take a separate argument.
tmux has to appear AFTER that: it is what separates a pane holding a nested
SERVER from one merely running a remote command (ssh host journalctl -f),
and from a plain remote login shell, neither of which has anything to
federate.
ssh is looked for as a TOKEN rather than as argv[0], because it routinely
is not argv[0]: when a #! script is named ssh (a ProxyCommand or kerberos
wrapper, and the stand-in the demo uses) the kernel runs it as
bash /path/to/ssh host …, so the interpreter holds argv[0] and requiring
that to read “ssh” silently found no hosts at all on such a machine.