updated _username() in when the ssh client doesn't support %r in ProxyCommand

in such a case, we use -o IdentityFile='%%username%%/%r' and parse the output of ssh -v
This commit is contained in:
Gregory Pakosz 2021-11-10 19:37:03 +01:00
parent c6bab99f05
commit d471ccc068
1 changed files with 2 additions and 1 deletions

View File

@ -574,7 +574,8 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# # shellcheck disable=SC2086
# username=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk '/^user / { print $2; exit }')
# # shellcheck disable=SC2086
# [ -z "$username" ] && username=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%username%% %r >&2'" $ssh_or_mosh_args 2>&1 | awk '/^%username% / { print $2; exit }')
# [ -z "$username" ] && username=$(ssh $ssh_or_mosh_args -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%username%% %r >&2'" 2>&1 | awk '/^%username% / { print $2; exit }')
# [ -z "$username" ] && username=$(ssh $ssh_or_mosh_args -v -T -o ControlPath=none -o ProxyCommand=false -o IdentityFile='%%username%%/%r' 2>&1 | awk '/%username%/ { print substr($4,12); exit }')
# else
# if ! _is_enabled "$ssh_only"; then
# username=${pane_info#*:}