Commit a805f856 authored by Kurt Hindenburg's avatar Kurt Hindenburg

For remote ssh processes, add %U which gets replaced by user@ if present

Add a new string replacement %U for remote tabs, which evaluates
to _user@ if user is non-empty, and the empty string otherwise.

Patch by Tobias Berner tcberner gmail com

Part of REVIEW 127525
parent d424d145
...@@ -1225,6 +1225,16 @@ QString SSHProcessInfo::format(const QString& input) const ...@@ -1225,6 +1225,16 @@ QString SSHProcessInfo::format(const QString& input) const
// search for and replace known markers // search for and replace known markers
output.replace(QLatin1String("%u"), _user); output.replace(QLatin1String("%u"), _user);
// provide 'user@' if user is defined -- this makes nicer
// remote tabs possible: "%U%h %c" => User@Host Command
// => Host Command
// Depending on whether -l was passed to ssh (which is mostly not the
// case due to ~/.ssh/config).
if (_user.isEmpty())
output.replace(QLatin1String("%U"), QString());
else
output.replace(QLatin1String("%U"), _user + '@');
if (isIpAddress) if (isIpAddress)
output.replace(QLatin1String("%h"), _host); output.replace(QLatin1String("%h"), _host);
else else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment