summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Hindenburg <[email protected]>2016-07-09 18:45:39 -0400
committerKurt Hindenburg <[email protected]>2016-07-09 18:45:39 -0400
commita805f856ff81b80ff1f6c1f70934ea89a4ca3414 (patch)
tree6c80dd8423814f737cb9882b438eec3f57bca24b
parentd424d1457d4cfbe5449f8d772a596324e674665c (diff)
For remote ssh processes, add %U which gets replaced by [email protected] if present
Add a new string replacement %U for remote tabs, which evaluates to [email protected] if user is non-empty, and the empty string otherwise. Patch by Tobias Berner tcberner gmail com Part of REVIEW 127525
-rw-r--r--src/ProcessInfo.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ProcessInfo.cpp b/src/ProcessInfo.cpp
index b6e3a09..c89d552 100644
--- a/src/ProcessInfo.cpp
+++ b/src/ProcessInfo.cpp
@@ -1225,6 +1225,16 @@ QString SSHProcessInfo::format(const QString& input) const
// search for and replace known markers
output.replace(QLatin1String("%u"), _user);
+ // provide '[email protected]' if user is defined -- this makes nicer
+ // remote tabs possible: "%U%h %c" => [email protected] 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)
output.replace(QLatin1String("%h"), _host);
else